Email is one of the most popular forms of digital communication. Python has a rich number of built-in libraries for dealing with emails. In this chapter, you will learn how to use Python to compose, send, and retrieve emails with the Simple Mail Transfer Protocol (SMTP), Post Office Protocol 3 (POP3), and Internet Message Access Protocol (IMAP) protocols. Practical code examples in Python 3.7 will illustrate most of these concepts in detail.
The following topics will be covered in this chapter:
- Learning about and understanding email protocols
- Sending emails with SMTP through the smtplib library
- Learning the POP3 protocol and retrieving emails with poplib
- Retrieving emails on the email server using IMAP with imapclient and imaplib