How does e-mail really work? What pathways are followed, which protocols are used and how it gets delivered to firstname.lastname@example.org and not to email@example.com is not really understood, despite millions e-mailing everyday.
Let’s assume that your e-mail address is firstname.lastname@example.org and you are using an e-mail client like Outlook or Thunderbird to send and receive e-mails. This is known as Mail User Agent (MUA). For sending mails, the MUA uses Simple Mail Transfer Protocol (SMTP) to a Mail Transfer Agent (MTA) like Gmail. In some cases, if the user is directly using the Web mail interface, the MUA does not come in the picture.
If the address in the “to” field has the same domain, then the MTA does a search in the local mailboxes (each user has their own mailbox, much like in the real world) and then delivers the mail. The receiver’s Mail Delivery Agent (MDA) (Outlook or a server) retrieves this mail either using the Post Office Protocol (POP3) or Internet Message Access Protocol (IMAP4). If POP3 is used, the message is copied to the local e-mail client and a copy is or isn’t retained on the server depending on the client settings. On the other hand, if IMAP4 is used, then a copy of the message is always retained on the server. However, this system works only for small networks. In case the domains are different, or the sender and the receiver are both using e-mail services like Gmail or Hotmail, an entirely different and complicated process takes place.
DNS And MX
In this case the MUA or Web mail connects to the local MTA, which is operated by the ISP. SMTP is used in this connection through port number 25. In case of heavy load, an e-mail queue is formed, while the MTA processes each e-mail. Rarely does the e-mail go directly to the receiver’s inbox when it has entered the cloud (Internet). Instead, it is accordingly routed, depending upon the availability or non-availability of MTAs. MTAs use the data in the headers of the e-mail to ask the Domain Name Servers (DNS) for the route. Typically, a single message would be routed across multiple MTAs before it’s delivered. Since IP addresses are the only thing that computers understand, the MTA typically looks at the domain name (the part after @) in the DNS to find the Mail Exchange (MX) record for that domain. Before this, domain name resolution has to be done, starting with the top level domains like .org, .edu, .net, .gov (there are 13 of them).
Consider that the e-mail address of the recipient is email@example.com. The MX record that is obtained from the DNS is actually a prioritised list of servers for otherdomain.com. The mail is progressively channelled through the different MX servers in a decreasing order of priority, until the designated host for the domain is found. MX servers are actually another name for MTAs that receive email. The last MTA then transfers the mail to the host and it is retrieved by the recipient using their MDA, or accessed through Web mail using either POP3 or IMAP4 protocols.
Spam, Relays, Firewalls
Spam is unsolicited e-mail which is recognised as the biggest disadvantage of e-mail. To prevent spam from clogging up inboxes, spam filters are used. Then there are firewalls and anti-virus filters that the e-mail must pass through. The anti-virus program resides at the firewall and checks all incoming mail and attachments for malicious code. If spyware or malware is found, then the message is quarantined.
Format And Security
The format of e-mail messages is called MIME (Multipurpose Internet Mail Extensions). Before MIME, only plain Roman text could be sent. MIME specified how other types of information are to be formatted so that they can be sent along with e-mails. The mapping between MIME and other formats are automatically done by MDAs and mail servers.
E-mail is usually sent over open channels, which made it open to interception. Nowadays, mechanisms like digital signature and PGP (Pretty Good Privacy) are used so that e-mail is reasonably secure. However, the way e-mail is delivered and stored leaves it open to privacy issues.
Pushmail is the type of e-mail found on handhelds and smart phones. In this type, the Internet connection is always “on” and the e-mail is immediately delivered to the device, the instant it arrives on the server. In many cases only the header may be retrieved to the handheld so that bandwidth is not wasted. IMAP4 supports pushmail, while Blackberry uses its proprietary push mail protocol in its devices.