(user, auth_string)
Authenticates to SMTP with the given auth_string.

  Args:
    user: The Gmail username (full email address)
    auth_string: A valid OAuth2 string, not base64-encoded, as returned by
        GenerateOAuth2String.
Authenticates to SMTP with the given auth_string.
Authenticates to SMTP with the given auth_string .
def TestSmtpAuthentication(user, auth_string):
  """Authenticates to SMTP with the given auth_string.

  Args:
    user: The Gmail username (full email address)
    auth_string: A valid OAuth2 string, not base64-encoded, as returned by
        GenerateOAuth2String.
  """
  print
  smtp_conn = smtplib.SMTP('smtp.gmail.com', 587)
  smtp_conn.set_debuglevel(True)
  smtp_conn.ehlo('test')
  smtp_conn.starttls()
  smtp_conn.docmd('AUTH', 'XOAUTH2 ' + base64.b64encode(auth_string))
def TestSmtpAuthentication ( user , auth_string ) : print smtp_conn = smtplib . SMTP ( 'smtp.gmail.com' , 587 ) smtp_conn . set_debuglevel ( True ) smtp_conn . ehlo ( 'test' ) smtp_conn . starttls ( ) smtp_conn . docmd ( 'AUTH' , 'XOAUTH2 ' + base64 . b64encode ( auth_string ) )