(imap_hostname, user, xoauth_string)
Authenticates to IMAP with the given xoauth_string.

  Prints a debug trace of the attempted IMAP connection.

  Args:
    imap_hostname: Hostname or IP address of the IMAP 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 IMAP with the given xoauth_string.
Authenticates to IMAP with the given xoauth_string .
def TestImapAuthentication(imap_hostname, user, xoauth_string):
  """Authenticates to IMAP with the given xoauth_string.

  Prints a debug trace of the attempted IMAP connection.

  Args:
    imap_hostname: Hostname or IP address of the IMAP 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
  imap_conn = imaplib.IMAP4_SSL(imap_hostname)
  imap_conn.debug = 4
  imap_conn.authenticate('XOAUTH', lambda x: xoauth_string)
  imap_conn.select('INBOX')
def TestImapAuthentication ( imap_hostname , user , xoauth_string ) : print imap_conn = imaplib . IMAP4_SSL ( imap_hostname ) imap_conn . debug = 4 imap_conn . authenticate ( 'XOAUTH' , lambda x : xoauth_string ) imap_conn . select ( 'INBOX' )