Introduction to email protocols

Often, end users use software or a graphical user interface (GUI) to write, send and receive emails., Also known as email clients, for example, Mozilla Thunderbird, Microsoft Outlook, etc., are customers of e-mail. The same tasks can be done through a web interface, that is, a web mail client interface. Some common examples of these are: Gmail, Yahoo mail and Hotmail

The mail you send from your client's interface travels through a series of specialized email servers that internally run software called the Mail Transfer Agent (MTA), and their main job is to route the email to destinations appropriate by analyzing the mail header.

Subsequently, the mail arrives at the recipient's mail server, which can be retrieved using his email client.

In this section we will review the main communication protocols that are used to send and receive emails, among which we can highlight:

  • SMTP: The SMTP protocol is used for sending emails from one host to another and allows you to transfer files between mail servers.
  • Simple Mail Transfer Protocol Secure (SMTPS): This encrypts communications while the email is being transferred between mail servers.
  • POP3: The POP3 protocol provides a standardized way for users to download messages from mailboxes to their computers. When using the POP3 protocol, your email messages will be downloaded from the internet service provider (ISP) mail server to your local computer. You can also leave copies of your emails on the ISP server.
  • IMAP: The IMAP protocol provides a standardized way of accessing your emails from your ISP. As this requires only a small data transfer, this scheme works well even over a slow connection, such as a mobile phone network. If you send a request to read a specific email, that email message will be downloaded from the ISP. You can also do some other interesting things, such as creating and manipulating folders or mailboxes on the server, and deleting messages. A mail client also pulls emails from the mail server, but has more functionality than POP3 since a copy of the message is retained on the mail server.
  • Secure/Multipurpose Internet Mail Extensions(S/MIME): This uses a public key infrastructure (PKI) to either encrypt the email or digitally sign the email to prove the integrity of the message. It is very cumbersome as it requires each user to exchange their public key and does not scale very well.

Python has three modules, smtplib, poplib, and imaplib, which support SMTP, POP3, and the IMAP protocols, respectively. Each module has options for transmitting the information securely by using the Transport Layer Security (TLS) protocol. Each protocol also uses some form of authentication for ensuring the confidentiality of the data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset