Emails have become an unavoidable part of our life. The simplicity of sending and receiving an email is the major reason for its popularity. If you want to send a mail you just need the receiver’s email ID, as a result, it is one of the easiest means for communication.
However, most of us are still unaware of the how email works. By knowing the working of Emails we can easily troubleshoot the common issues we face while using Emails.
The ground reality is that the working of emails is not as simple as it may seem. There are a number of complex activities running on background when we use mail communication.
Before jumping into the working of emails lets see some very basic terms associated with it.
Common terms used
MUA:
Mail User Agent, Program for viewing, reading, composing Emails.
eg: Webmail, MS Outlook, Mozilla Thunderbird, Apple Mail, elm, pine, mutt
MTA:
Mail Transfer Agent, Program for Routing the mails. It accepts mails either dispatched by an MUA for delivery or from MDA for reception
eg: Exim, Sendmail, Postfix, Zimbra, QMail
MDA:
Mail Delivery Agent, which performs the actual delivery.
eg: mail.local, procmail
Since we have seen the basic agents involved in Email communication, we can see how these “Agents” help us in mail communication.
Basic Working of Emails
- A user composes an Email using MUA and sends it.
- The Email is being transferred to the corresponding MTA/MDA. Some of the MTAs available today (Exim, Sendmail, QMail) and will handle the responsibilities of a MDA as well. So based on the headers of the Email, MTA determines the destination address, and it knows how to reach there, the mail is being transferred further to the MDA. The mail is being routed either locally or remote based on the Mail exchanger it is set to.
- The MTA at the receiver end identifies the message and pass on the local MDA.
- The local MDA hand overs the Email message to the MUA at the receiver end.
The image shown below represents the whole process.
Since we have seen the basic working of emails, let us dive deeper into the working now.
Detailed Explanation
First of all with the aid of MUA user composes the Email.
This involves mainly three parameters, such as the Outgoing Mail server name, Email address, and the password. Once the MUA authentication of those directives are complete, the message is passed over to the MTA for further process.
For instance, consider the sending Email address as alex@sender.com and the recipient as mark@recipient.com. The sending MTA checks where the recipient domain recipient.com resolves to. It asks the DNS server on the recipient.com network for the hostname of the mail server. The MX (Mail Exchanger) record in DNS identifies the Host Name of the mail server. The DNS server for recipient.com returns the value of the MX record, which is the hostname of the mail server, something like, mail.recipient.com.
The sending MTA now asks the DNS server on the recipient.com network for the address of the mail server host (mail.recipient.com). The A record in DNS maps the host name to an IP address. The DNS server for recipient.com returns the value of the A record for the mail server host (mail.recipient .com), which would be some IP address.
The sending mail server connects to the receiving mail server’s IP address and checks whether it can connect to the SMTP port of the recipient mail server and if it can, then it will deliver the E-mail.