Electronic Mail (e-mail) is a foundational, highly distributed application-layer service in the TCP/IP suite. It enables users to exchange asynchronous textual messages and multimedia attachments across globally dispersed networks.
To model modern e-mail exchange, we analyze its architecture through four evolutionary scenarios. This helps us understand how the interaction scales from single-system environments to multi-network topologies.
When the sender and the receiver share the same mail server (e.g., two users on the same corporate subnet or university host), only two User Agents (UAs) are required. The sender utilizes a local UA to draft and submit the message, which is moved directly to the receiver's mailbox file on the same machine.
When the sender and the receiver reside on different mail servers, the system requires two UAs and a pair of Message Transfer Agents (MTAs) (one client, one server). The sender’s UA hands the message to their local server. The server, acting as an MTA client, initiates a transmission directly to the destination server, which acts as an MTA server.
If the sender does not run a mail server locally and is connected to a remote mail server via a LAN or WAN, the architecture requires two UAs and two pairs of MTAs (client/server). The sender's local host acts as an MTA client to push the message up to their intermediate mail server. That intermediate mail server then acts as an MTA client to forward the message to the receiver's mail server.
This is the standard architecture of internet mail today. Since receivers are rarely connected to their mail servers continuously, emails cannot be pushed directly to the receiver's physical machine. Instead, they must be stored on a permanent mail server.
This paradigm requires:
+--------------+
| Sender's UA |
+------+-------+
| (LAN / WAN)
v [MTA Client] --- Push Protocol (SMTP)
+--------------+
| Sender's |
| Mail Server | [MTA Server]
+------+-------+
|
| [MTA Client] --- Push Protocol (SMTP over Internet)
v
+--------------+
| Receiver's |
| Mail Server | [MTA Server]
+------+-------+
| (Mailbox storage)
v [MAA Server] --- Pull Protocol (POP3 / IMAP4)
+--------------+
| Receiver's |
| UA | [MAA Client]
+--------------+An important operational distinction in email architecture is the direction of bulk data transfer relative to the client initiating the transaction:
The User Agent (UA) is a software application that provides services to the user to simplify the composition, transmission, and retrieval of email messages.
mail, pine, and elm.An email message consists of an envelope and the actual content. The content is structured into two main parts: the Header and the Body.
+------------------------------------------+
| ENVELOPE |
| (Sender address, Receiver address) |
+------------------------------------------+
| HEADER |
| To: recipient@domain.com |
| From: sender@domain.com |
| Subject: Network Curriculum Overview |
| Date: 2026-07-15 |
+------------------------------------------+
| BLANK LINE |
+------------------------------------------+
| BODY |
| This is the actual textual content |
| of the email message. |
+------------------------------------------+The format of the header is defined in RFC 822. Each header line contains a keyword, a colon, and a value. Key fields include:
To: The recipient's email address.From: The sender's email address.Subject: The topic of the message.Date: The local date and time when the message was written.E-mail addresses are globally unique identifiers structured into two parts separated by an @ sign:
The actual relaying of email across the Internet is executed by Message Transfer Agents (MTAs). The official protocol defining MTA client-server interactions in the TCP/IP stack is the Simple Mail Transfer Protocol (SMTP).
SMTP operates at the application layer and uses the reliable transport services of TCP on well-known port 25.
SMTP transactions consist of ASCII commands sent by the client and numeric status codes (with optional text) sent by the server.
| Command | Argument | Description |
| :--- | :--- | :--- |
| HELO / EHLO | sender_domain | Initiates the session and identifies the sender's domain. |
| MAIL FROM | sender_address | Identifies the originator of the message. |
| RCPT TO | recipient_address | Identifies the individual recipient of the message. |
| DATA | None | Signals the start of the message body. |
| QUIT | None | Closes the connection. |
Server responses are 3-digit status codes:
220: Service ready.250: Requested mail action completed (OK).354: Start mail input; end with <CR><LF>.<CR><LF>.221: Service closing transmission channel.An SMTP transaction is divided into three distinct phases:
Client (Sender MTA) Server (Receiver MTA)
| |
| ============= TCP Port 25 Connection ============= |
| <------------------ 220 Service Ready ------------ |
| --- HELO deanza.edu -----------------------------> |
| <------------------ 250 OK ----------------------- | (Connection Established)
| |
| --- MAIL FROM:<forouzanb@adelphia.net> -----------> |
| <------------------ 250 OK ----------------------- |
| --- RCPT TO:<admin@kophub.com> -------------------> |
| <------------------ 250 OK ----------------------- |
| --- DATA ----------------------------------------> |
| <------------------ 354 Start Input -------------- |
| --- (Message Headers & Body) --------------------> |
| --- <CR><LF>.<CR><LF> (End of Mail Indicator) ---> |
| <------------------ 250 OK (Queued for Delivery) - | (Message Transferred)
| |
| --- QUIT ----------------------------------------> |
| <------------------ 221 Service Closed ----------- | (Connection Terminated)The following log trace illustrates a raw SMTP session over a Telnet interface:
$ telnet mail.kophub.com 25
Trying 192.0.2.55...
Connected to mail.kophub.com.
Escape character is '^]'.
S: 220 mail.kophub.com ESMTP Postfix
C: HELO local.client.org
S: 250 mail.kophub.com Hello local.client.org, pleased to meet you
C: MAIL FROM:<student@local.client.org>
S: 250 2.1.0 <student@local.client.org>... Sender ok
C: RCPT TO:<editor@kophub.com>
S: 250 2.1.5 <editor@kophub.com>... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Subject: SMTP Protocol Verification
C: Date: Tue, 15 Jul 2026 10:00:00 UTC
C:
C: This is a verified test of SMTP interactive raw transmission.
C: .
S: 250 2.0.0 qA6G00z01234 Message accepted for delivery
C: QUIT
S: 221 2.0.0 mail.kophub.com closing connection
Connection closed by foreign host.Once an email reaches the destination mail server, it is stored in the recipient's mailbox. Because the recipient’s UA runs on a local machine (which is often offline, behind a NAT, or dynamically addressed), SMTP cannot be used to deliver the email directly to the client. Instead, a Message Access Agent (MAA) pull protocol is required.
The two primary standards for message access are POP3 and IMAP4.
+--------------------------------+
| Destination Mail Server |
+---------------+----------------+
|
| Message Access Agent
| (Pull Protocols)
+-------------+-------------+
| |
v v
[ POP3 Port 110 ] [ IMAP4 Port 143 ]
"Download & Delete" "Interactive Sync"
| |
v v
+--------------+ +--------------+
| Local Client | | Local Client |
+--------------+ +--------------+POP3 is a simple, highly efficient pull protocol that operates on well-known TCP port 110.
IMAP4 is a sophisticated and feature-rich pull protocol that operates on well-known TCP port 143.
SMTP was designed to transmit messages exclusively in Network Virtual Terminal (NVT) 7-bit ASCII format. This means it cannot natively transmit:
To overcome these limitations without altering the core SMTP protocol, Multipurpose Internet Mail Extensions (MIME) was introduced as a supplementary standard.
+-----------------------+
| Non-ASCII / Binary | (e.g., Executable, Image, UTF-8 Text)
+-----------+-----------+
|
v [MIME Encoder (Sender Site)]
+-----------------------+
| NVT 7-bit ASCII | (Transformed into printable ASCII characters)
+-----------+-----------+
|
v [MIME Encoded SMTP Transmission]
+-----------------------+
| NVT 7-bit ASCII |
+-----------+-----------+
|
v [MIME Decoder (Receiver Site)]
+-----------------------+
| Non-ASCII / Binary | (Reconstructed into original format)
+-----------------------+MIME adds five custom headers to the RFC 822 format to describe the content structure and encoding method used:
MIME-Version: 1.0
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Description: Diagram of the network topology
Content-Id: <1029384756@kophub.com>1.0).text/html, image/png, application/pdf, multipart/mixed).base64 or quoted-printable).Base64 encoding is used to convert arbitrary binary files into printable ASCII characters.
The algorithm operates as follows:
A-Z (), (), (), (), and ().
This results in an overhead of approximately .
Original Binary: [ 8-bit Byte 1 ] [ 8-bit Byte 2 ] [ 8-bit Byte 3 ] (24 bits total)
/ \ / \ / \
/ \ / \ / \
6-bit Divisions: [6-bit G1] [6-bit G2] [6-bit G3] [6-bit G4] (4 groups)
| | | |
Mapped Characters: 'U' 'C' 'S' 'P' (NVT 7-bit ASCII)Quoted-Printable encoding is used when the data consists mostly of ASCII text with only a few non-ASCII characters (e.g., accented characters in French or Spanish).
= followed by its two-digit hexadecimal representation. For example, the decimal byte (which is 0xF5 in hex) is encoded as =F5.E-mail service is highly integrated with the World Wide Web. Many users access their mailboxes through web interfaces (e.g., Gmail, Yahoo Mail, Outlook.com) rather than dedicated local clients. This architecture changes the protocols used in some parts of the system.
The sender uses a web browser to access their webmail account. The receiver uses a classic desktop user agent (e.g., Thunderbird).
Both the sender and the receiver use a web browser to manage their emails.
HTTP SMTP HTTP
[ Sender Browser ] ===> [ Sender Mail Server ] ===> [ Receiver Mail Server ] ===> [ Receiver Browser ]The standard application-layer email protocols (SMTP, POP3, IMAP4) transmit messages, credentials, and attachments in cleartext, exposing them to eavesdropping and tampering. To secure these transmissions, email networks use application-layer cryptographic protocols:
In addition to these application-layer protocols, modern e-mail services use transport-layer security (TLS/SSL) to encrypt connection channels (e.g., SMTPS on port 465, POP3S on port 995, and IMAPS on port 993).
An application-layer software component (e.g., Outlook, Thunderbird) that allows users to compose, send, read, and manage email messages.
The core system software responsible for relaying email across networks using client-server SMTP interactions over TCP port 25.
A client-server program (e.g., POP3, IMAP4) designed as a pull protocol to retrieve stored messages from a mail server to a local machine.
The standard application-layer push protocol that facilitates reliable end-to-end transport of email messages across the Internet.
Multipurpose Internet Mail Extensions; a supplementary protocol standard that translates non-ASCII binary attachments into NVT 7-bit ASCII format for SMTP transfer.
Test your understanding with 5 questions
Why is SMTP unsuitable as the final protocol used to download emails from a recipient's mail server to their local host?
In the most common modern email architecture (the Fourth Scenario), which set of components is required?
What is the primary operational difference between POP3 and IMAP4?
If a binary executable file of 30,000 bytes is encoded using Base64 for email transmission, what will be the approximate size of the encoded payload?
In Web-based email (e.g., Gmail, Yahoo Mail) when Case II is active (where both sender and receiver use a web browser), which protocols are used across the system?
a-z0-9+/6 Modules
6 Modules