(smtp_hostname, user, xoauth_string)
Authenticates to SMTP with the given xoauth_string.

  Args:
    smtp_hostname: Hostname or IP address of the SMTP service.
    user: The Google Mail username (full email address)
    xoauth_string: A valid XOAUTH string, as returned by GenerateXOauthString.
        Must not be base64-encoded, since IMAPLIB does its own base64-encoding.
Authenticates to SMTP with the given xoauth_string.
Authenticates to SMTP with the given xoauth_string .
def TestSmtpAuthentication(smtp_hostname, user, xoauth_string):
  """Authenticates to SMTP with the given xoauth_string.

  Args:
    smtp_hostname: Hostname or IP address of the SMTP service.
    user: The Google Mail username (full email address)
    xoauth_string: A valid XOAUTH string, as returned by GenerateXOauthString.
        Must not be base64-encoded, since IMAPLIB does its own base64-encoding.
  """
  print
  smtp_conn = smtplib.SMTP(smtp_hostname, 587)
  smtp_conn.set_debuglevel(True)
  smtp_conn.ehlo('test')
  smtp_conn.starttls()
  smtp_conn.docmd('AUTH', 'XOAUTH ' + base64.b64encode(xoauth_string))
def TestSmtpAuthentication ( smtp_hostname , user , xoauth_string ) : print smtp_conn = smtplib . SMTP ( smtp_hostname , 587 ) smtp_conn . set_debuglevel ( True ) smtp_conn . ehlo ( 'test' ) smtp_conn . starttls ( ) smtp_conn . docmd ( 'AUTH' , 'XOAUTH ' + base64 . b64encode ( xoauth_string ) )