
Gmail
Source code: Lib/imaplib.py This module defines three classes, IMAP4 , IMAP4_SSL and IMAP4_stream , which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in RFC 2060 . It is backward compatible with IMAP4 ( RFC 1730 ) servers, but note that the STATUS command is not supported in IMAP4. Three classes are provided by the imaplib module, IMAP4 is the base class:
20.10. imaplib — IMAP4 protocol client — Python v2.7.2 documentation
This document describes the IMAP extensions provided by Gmail and how they may be used by developers. This document assumes familiarity with the IMAP protocol . Overview Gmail provides a set of IMAP extensions to allow authors of IMAP clients provide a more Gmail-like experience through IMAP. These extensions may also be useful to those creating other types of integrations with Gmail, such as Gmail contextual gadgets . The extensions may be used when accessing Gmail through the standard IMAP protocol or when connecting via OAuth .
Gmail APIs and Tools - Google Code
imaplib implements a client for communicating with Internet Message Access Protocol (IMAP) version 4 servers. The IMAP protocol defines a set of commands sent to the server and the responses delivered back to the client. Most of the commands are available as methods of the IMAP4 object used to communicate with the server. These examples discuss part of the IMAP protocol, but are by no means complete.
imaplib - IMAP4 client library
This is the third post in the article series “Playing With Python And Gmail”. This will be a tutorial on how to send mails using Python smtplib through Gmail SMTP. The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. [vinod@mercury ~]$ python Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import smtplib
PYTHON
I couldn’t find all that much information about IMAP on the web, other than the RFC3501 . The IMAP protocol document is absoutely key to understanding the commands available, but let me skip attempting to explain and just lead by example where I can point out the common gotchas I ran into. Let’s start by searching our inbox for all mail with the search function. Use the built in keyword “ALL” to get all results (documented in RFC3501). We’re going to extract the data we need from the response, then fetch the mail via the ID we just received. The imap search function returns a sequential id, meaning id 5 is the 5th email in your inbox.

