Electronic Mail (EMAIL) Architecture and Protocols
1. Architectural Components of Email Systems
The Internet Electronic Mail (EMAIL) system consists of three architectural components operating in concert:
SENDER USER AGENT (UA) RECEIVER USER AGENT (UA)
(Outlook / Thunderbird) (Outlook / Phone Mail)
| ^
| SMTP (Push) | POP3 / IMAP (Pull)
v |
SENDER MAIL SERVER (MTA) RECEIVER MAIL SERVER (MTA)
(Postfix / Sendmail) ─── SMTP Relay (TCP Port 25) ────────> (Stores mail in User Mailbox)
- User Agent (UA): Client application program that allows the user to read, compose, reply to, and forward email messages (e.g., MS Outlook, Thunderbird, Apple Mail).
- Message Transfer Agent (MTA): Server software responsible for transferring and relaying messages across the Internet using SMTP (e.g., Postfix, Sendmail, Exim).
- Message Access Agent (MAA): Protocols used by the receiving client to retrieve stored messages from the remote mailbox (POP3 or IMAP4).
2. Simple Mail Transfer Protocol (SMTP)
SMTP (RFC 5321) is a connection-oriented Push Protocol used to transfer messages from the sender's UA to the local mail server, and between mail servers across the Internet.
Transport Ports:
- TCP Port 25: Standard port for Server-to-Server (MTA-to-MTA) relaying.
- TCP Port 587: Modern authenticated Message Submission (UA-to-MTA) with mandatory TLS encryption.
- TCP Port 465: Legacy SMTPS (SMTP over SSL).
Standard SMTP Dialog Exchange:
Client (MTA) Server (MTA)
| |
|<--- 220 mail.example.com ESMTP ready -----|
|--- EHLO client.domain.com --------------->|
|<--- 250 OK (Capabilities listed) ---------|
|--- MAIL FROM:<alice@domain.com> ---------->|
|<--- 250 Sender OK ------------------------|
|--- RCPT TO:<bob@example.com> ------------>|
|<--- 250 Recipient OK ---------------------|
|--- DATA --------------------------------->|
|<--- 354 Start mail input; end with <CRLF>.<CRLF>
| Subject: Meeting Tomorrow |
| Hi Bob, see you at 10 AM. |
| . |
|<--- 250 OK: Message queued 12345 ---------|
|--- QUIT --------------------------------->|
|<--- 221 Service closing transmission -----|
3. Multipurpose Internet Mail Extensions (MIME)
The original SMTP standard (RFC 821) was strictly limited to 7-bit ASCII characters, making it impossible to transmit rich text, accented European characters, Asian languages, or binary attachments (images, PDFs, audio).
MIME (RFC 2045) solves this by defining headers that convert non-ASCII and binary data into 7-bit ASCII bitstreams:
Non-ASCII / Binary Data (PDF / JPEG)
|
v
[ Base64 Encoding ] (Transforms 3 binary bytes into 4 ASCII characters)
|
v
Standard 7-bit ASCII Transmitted via SMTP
Key MIME Headers:
MIME-Version: Specifies MIME standard version (e.g.,1.0).Content-Type: Declares the media format of the payload:- Text:
text/plain,text/html. - Image:
image/jpeg,image/png. - Application:
application/pdf,application/octet-stream. - Multipart:
multipart/mixed(combines body text with file attachments).
- Text:
Content-Transfer-Encoding: Declares the encoding algorithm used (e.g.,base64,quoted-printable).
4. Mail Access Protocols: POP3 vs. IMAP4
Because an end user's personal laptop or smartphone is not connected to the Internet 24/7 with a static public IP, incoming email must be received and stored on a central mail server. The user then pulls the mail down via an MAA protocol:
MAIL RETRIEVAL (PULL)
|
+----------------------------+----------------------------+
| |
POST OFFICE PROTOCOL 3 (POP3) INTERNET MESSAGE ACCESS PROTOCOL (IMAP4)
- Simple download-and-delete - True multi-device server synchronization
- Mail stored locally on client - Mail stays on central server
- Single-device workflow - Multi-device workflow (Phone + Laptop)
- Port 110 (Plain) / Port 995 (SSL) - Port 143 (Plain) / Port 993 (SSL)
1. POP3 (Post Office Protocol Version 3 - RFC 1939):
- Download and Delete: Downloads all emails from the server to the client computer's local hard drive and deletes them from the server.
- Limitation: If you download an email on your work computer, it is no longer available when you check your smartphone later!
2. IMAP4 (Internet Message Access Protocol Version 4 - RFC 3501):
- Client-Server Synchronization: Emails permanently reside on the remote server. The client downloads only message headers, retrieving message bodies and attachments on demand.
- Hierarchical Folders: Folders created, renamed, or organized on a smartphone are instantly synchronized to all other devices.
- Server-Side Searching: Allows searching large mail archives on the server without downloading gigabytes of email locally.
5. Comprehensive Protocol Comparison
| Parameter | SMTP | POP3 | IMAP4 |
|---|---|---|---|
| Role | Mail Transmission / Relay | Mail Retrieval | Mail Retrieval & Sync |
| Direction | Push (Client Server) | Pull (Server Client) | Pull (Server Client) |
| Default Port | TCP 25 (MTA), 587 (TLS) | TCP 110 (Plain), 995 (SSL) | TCP 143 (Plain), 993 (SSL) |
| Storage Model | Ephemeral queue in transit | Local storage on client PC | Centralized server storage |
| Multi-Device | N/A | Very poor (No synchronization) | Perfect synchronization |
| Partial Fetch | Sends full message | Downloads whole message | Can fetch headers / parts only |
6. Key Exam Questions & Takeaways
- Why is SMTP called a "Push" protocol while POP3 and IMAP4 are "Pull" protocols?
- SMTP initiates the connection to push outgoing email from the sender to the mail server and between servers. POP3 and IMAP4 are initiated by the recipient client to pull stored email from the remote mailbox down to the local user interface.
- What is the function of MIME in email?
- MIME extends the original 7-bit ASCII limitation of SMTP, allowing users to send binary files, rich multimedia, and international character sets by encoding them into ASCII text using algorithms like Base64.
- State two major advantages of IMAP4 over POP3.
- IMAP keeps all messages synchronized across multiple client devices in real-time, and supports server-side folder management and partial downloads of message headers.