November 7, 2019
3 min Read
November 7, 2019
3 min Read
Probably all of you are already familiar with the most used communication technology – email. But have you ever questioned yourself how it actually works? In this article, we will learn what drives this service.
POP3 and IMAP protocols are used to connect to your email provider and retrieve emails using your email client whereas SMTP is used to send emails. The email client can be an application like Thunderbird or a web based client like Gmail, Yahoo! We will learn about the POP3 and IMAP protocol. Then will talk about how email works and the protocol used to send emails – SMTP.
POP3 (Post Office Protocol version 3) is used to communicate with the remote email server and download the emails to a local email client like Outlook, Thunderbird, Windows Mail, Mac Mail, etc. Usually, an email client will have an option whether to leave copies of the downloaded emails on the server or not. If you are accessing the same email account from different devices, it’s recommended to keep remote copies as otherwise, your second device will not download any emails if the first one already deleted them. It is also worth mentioning that POP3 is a one-way communication protocol, which means that data is pulled from the remote server and sent to the local client.
IMAP (Internet Message Access Protocol) like POP3 is also used for retrieving emails to local email clients, however, it has a major difference – only email headers are downloaded, actual email message contents are left on the server. This is a two-way communication protocol as changes made on the email client are transmitted to the server. Lately, this protocol gained more popularity as email provider giants, like Gmail, recommend using IMAP instead of POP3.
Simple Mail Transfer Protocol (SMTP) is used to communicate with the remote server in order to send the email from a local client to the remote server and eventually to the recipient’s email server. This process is controlled by Mail Transfer Agent (MTA) on your email server. Also, SMTP is used solely to send emails.
Now let’s see what happens when you send an email.
When you click the send button your email client connects to your email provider’s SMTP server (Mail Transfer Agent) using SMTP protocol. Suppose you are using Gmail then your email client contacts SMTP server of Gmail – smtp.gmail.com. The SMTP server at Gmail checks your email for recipient’s email address. Suppose the recipient is email@example.com then Gmail SMTP server looks for the MX (mail exchanger) record of example.com from DNS. An MX record is a record in the DNS that specifies a mail server responsible for accepting emails on behalf of a recipient’s domain. After retrieving the address of SMTP server of example.com from its MX record the Gmail SMTP server sends the email to SMTP server of example.com. The SMTP server of example.com checks if the ‘person’ recipient exists on that server. If the account exists on that server it forwards the email to its own IMAP / POP3 server (mail delivery agent) to store this email.
Now the recipient person can connect to this server using an email client like Outlook (Mail User Agent) and read the email. Sometimes there are multiple hops between the sender’s and recipient’s SMTP server otherwise the process is generally the same.
We hope that now you have a better understanding of email service and what ports it uses. We have learned that POP3 and IMAP are intended for the same purpose, but have a different approach with IMAP leaving email content on the server and POP3 downloading it all to your computer. We have also learned what are default SMTP, POP3, and IMAP ports. We also learned about the protocol used to send an email – SMTP and how it is used.