Last updated on September 1, 2020 by Sarmed Rahman
Email service is one of the most often used services globally. Today almost everyone has at least one email account. Although clicking on the email send button and delivery of an email message appear seamless, a lot of events take place behind the scenes to make sure that the email reaches its final destination.
The functionality of a mail server can be divided broadly into two processes: sending and receiving emails. The following two protocols oversee these processes.
The following terminology is important in understanding the operation of a mail server.
When a sender clicks on the send button, SMTP (MTA) ensures end to end delivery of an email from a sender-side server to a destination server. Upon reaching the destination server, the MTA local to the destination server accepts the email, and hands it over to the local MDA. The MDA then writes the email to a receiver's mailbox. When the recipient checks for emails, they are fetched by MUA by using protocols like POP or IMAP.
exampleB.tstdomains have proper DNS registrations.
MXrecords for both domains (the records are shown in the figure).
A series of the following events take place as soon as a user initiates sending an email.
exampleA.tstmail server using SMTP (typically TCP Port
mail.exampleA.tstreceives an email, and learns that a destination domain is
exampleB.tst. The mail server generates a query to a local DNS server asking about the
exampleB.tst. Let us assume that there is no information about the destination domain in the local DNS cache yet.
MXrecord details of
exampleB.tst. This information is shared with the mail server
mail.exampleA.tstas an answer.
mail.exampleB.tstover the Internet. SMTP is used for communication between the source and destination mail servers.
mail.exampleB.tst. After the email is received, it is handed over to MDA, which then writes the mail to a recipient's mailbox stored in the server. The server has separate mailboxes for each user.
Most ISPs maintain their own Mail Exchangers (
MX) for their customers. These
MX servers are also known as Smarthosts or Relay Servers. Smarthosts are usually equipped with advanced virus scanners, powerful spam mail detection and blocking systems. These servers are also built to ensure maximum up-time and best performance for email delivery service.
Using the service provider
MX is optional, but it can provide some additional benefits, such as:
MXis the last hop before a customer's end mail server. Even if a customer's mail server goes down, incoming mails will stay in the SMTP queue of ISP
MXuntil queue timer expires. The
MXserver will keep trying to send emails periodically to the customer. Emails can be delivered whenever the customer' mail server comes back online. This feature can significantly reduce the rate of undelivered emails, i.e. bounces.
Let us assume that
exampleA.tst is a customer of ISP
exampleB.tst a customer of ISP
B. Also assume that
exampleA.tst mail server is configured to send all outgoing mails via
exampleB.tst wants to use the
MX server of the ISP
mx.ispB.com. As mentioned earlier, the lowest
MX record gets the highest priority. Keeping this in mind. The (hypothetical)
MX record for
exampleB.tst can be defined as below.
IN MX 10 mx.ispB.com IN MX 20 mail.exampleB.tst mx.ispB.com IN A Y.Y.Y.Y mail.exampleB.tst IN A B.B.B.B
[email protected]MUA to mail server
mail.exampleA.tstusing SMTP. The mail server
mail.exampleA.tstis configured to send all outbound mails to
mx.ispA.com, instead of sending emails directly towards a destination over the Internet. Virus/spam check is done as soon as ISP
Arelay host i.e.,
MXreceives the email.
mx.ispA.comdoes not have any DNS information about
exampleB.tst, a query is sent to a local DNS server asking about the
MX20 records. Since
MX10 is the lowest
MXrecord, it will be used as a primary mail server.
MX20 will be used only when
MX10 goes down i.e., ISP
BSmarthost is unreachable for some reason. The DNS server answers the query of the
MXserver with necessary information.
mx.ispA.tsthas all necessary information, it sends the email directly towards
mx.ispB.comover the Internet. The email is scanned upon arrival. When the ISP
BSmarthost recognizes that the server itself is not the final destination, it forwards the email to the customer's mail server, based on the forwarding decision configured by the server's administrator.
mail.exampleB.tstreceives the incoming mail, and hands it over to local MDA. The MDA in turn delivers the email to a recipient's mailbox.
To sum up, the entire process of email communication needs many steps performed in the background. Based on the configuration, emails can be sent directly over the Internet from one server to another. Service provider
MX can also be used depending on the requirements, and of course, SLAs (Service Level Agreements).
Hope this helps.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.