Sending Email with Simple Mail Transfer Protocol (SMTP)

Author: Conrad Chung, 2BrightSparks Pte. Ltd.

Download PDF version [opens new window]

If you use the Internet you probably use email. Whether you are a student, a white collar worker, or someone using a computer from home, it is very likely that you will have more than one email address: for example, it is useful to have one address to use for messages intended for a broad audience, and another for personal messages.

Despite the widespread use of email, most people have little understanding behind the way email is sent to recipients. This article introduces readers to the protocol required for sending emails.

What is SMTP?

SMTP is short for Simple Mail Transfer Protocol, an Internet standard for transmission of electronic mail (email) across the Internet.

In 1981, SMTP was first defined in the Request for Comments (RFC) 788. It achieved a milestone in 1982 when RFC 821 and RFC 822 were published, which were further updated following the release of RFC 2821 and RFC 2822 in 2001. The latest RFC 5321 was released in 2008.

SMTP traditionally operates from TCP port 25 although various STMP mail servers use port 587 as the former is prone to attacks from malware and spam. An SMTP client and SMTP server communicate using human readable text commands.

Client-level email applications use SMTP to send outbound messages to an SMTP mail server. The server then relays the mail through a sequence of SMTP servers and mail transfer agents (MTA) to get to its destination. The SMTP server will not involve other external servers for delivery if both sender and receiver has the same domain address.

How does SMTP work?

Below is an overview of the email delivery process:

1. Composition of Mail

A user sending an email starts by composing an electronic mail message using an authenticated mail client (Mail User Agent: MUA). The message contains the body and the header. The body is the main part of the message while the header contains control information like the sender and recipient email addresses. Headers also include descriptive information like the subject and message submission date/time stamp.

This is analogous to real mail, where the message body is like a letter and the header is like the envelope containing the recipient’s address and a return address.

2. Submission of Mail

The mail client then submits the completed email to the configured SMTP server or mail server (Mail Submission Agent: MSA) using SMTP on TCP port 25 or 587, which acts as an electronic post office. This is similar to how letters gets dropped off at the post office for sorting and delivery.

3. Delivery of Mail

Email addresses like john@email.com are sorted in a similar way. The “john” portion in the address is the username of the recipient and “email.com” is the domain name, similar to a postal address.

If the domain name of the recipient’s email address is different from the sender, MSA will hand the mail over to the Mail Transfer Agent (MTA). The role of MTA is to relay emails containing recipient email addresses with different domain names – similar to how post office transfer letters addressed to a different state/country. MTA also uses SMTP to receive emails relayed from other MTAs.

To relay the email, the MTA must first locate the target domain. It does this by requesting for the mail exchanger record (MX record) from the Domain Name System (DNS). The MX record contains the name and Internet Protocol (IP) address of the recipient’s domain. IP addresses are similar to postal codes. Once the record is located, MTA connects to the exchange server to relay the message.

4. Receipt and Processing of Mail

Once the incoming message is accepted, the exchange server delivers it to the incoming mail server (Mail Delivery Agent, MDA) which stores the email where it waits for the user to retrieve it. This is equivalent to the real world example where the recipient’s local post office delivers the mail into an individual’s post office boxes.

5. Access and Retrieval of Mail

The stored email can be retrieved by authenticated mail clients (MUAs). By using a login and password to access the MUA, MDA ensures individual users only have the right to access their own emails.

Instead of SMTP, email clients use either Internet Message Access Protocol (IMAP) or Post Office Protocol (POP) to retrieve emails. POP is used for retrieving emails while IMAP manages and facilitate access to mail. Unlike SMTP, POP and IMAP are specifically designed to retrieve messages.

Conclusion

The use of the SMTP protocol is not just confined to sending emails from a client email program. For example, the backup and synchronization programs SyncBackFree, SyncBackSE, and SyncBackPro developed by 2BrightSparks have the option to send email logs of completed profile jobs to an email address. SyncBackPro has the added function to backup data or synchronize files with an email server like Yahoo! or Gmail.

By understanding the fundamentals of SMTP, we are better able to appreciate how emails are sent and how SMTP applies to SyncBackFree/SE/Pro.


Noted Customers

© 2017 2BrightSparks Pte. Ltd.  | Home | Support | Privacy | Terms

Back to top