■ ContentsxiiiHow SMTP Is Used ��������������������������������������������������������������������������������������������������������������������244
Sending E-Mail �������������������������������������������������������������������������������������������������������������������������������������������������� 246Headers and the Envelope Recipient ����������������������������������������������������������������������������������������������������������������� 246Multiple Hops ����������������������������������������������������������������������������������������������������������������������������������������������������� 247Introducing the SMTP Library ����������������������������������������������������������������������������������������������������248
Error Handling and Conversation Debugging ����������������������������������������������������������������������������249
Getting Information from EHLO �������������������������������������������������������������������������������������������������252
Using Secure Sockets Layer and Transport Layer Security �������������������������������������������������������254
Authenticated SMTP ������������������������������������������������������������������������������������������������������������������256
SMTP Tips ���������������������������������������������������������������������������������������������������������������������������������� 258
Summary ����������������������������������������������������������������������������������������������������������������������������������� 258
■ Chapter 14: POP ������������������������������������������������������������������������������������������������������������259
POP Server Compatibility ����������������������������������������������������������������������������������������������������������259
Connecting and Authenticating �������������������������������������������������������������������������������������������������260
Obtaining Mailbox Information ��������������������������������������������������������������������������������������������������263
Downloading and Deleting Messages ���������������������������������������������������������������������������������������264
Summary ����������������������������������������������������������������������������������������������������������������������������������� 266
■ Chapter 15: IMAP �����������������������������������������������������������������������������������������������������������267
Understanding IMAP in Python ��������������������������������������������������������������������������������������������������268
IMAPClient ��������������������������������������������������������������������������������������������������������������������������������������������������������� 270Examining Folders ��������������������������������������������������������������������������������������������������������������������������������������������� 272Message Numbers vs� UIDs ������������������������������������������������������������������������������������������������������������������������������� 273Message Ranges ����������������������������������������������������������������������������������������������������������������������������������������������� 273Summary Information ���������������������������������������������������������������������������������������������������������������������������������������� 274Downloading an Entire Mailbox ������������������������������������������������������������������������������������������������������������������������� 275Downloading Messages Individually ����������������������������������������������������������������������������������������������������������������� 277Flagging and Deleting Messages ����������������������������������������������������������������������������������������������������������������������� 283Deleting Messages �������������������������������������������������������������������������������������������������������������������������������������������� 283