Components
The Internet mail system has three major elements:
- MUA (mail user agents)
- allow users to read, reply to, forward, save, and compose messages
- MTA (mail transfer agents) or mail servers
- core of the e-mail infrastructure
- protocols (e.g., SMTP for sending, IMAP/POP3/HTTP for retrieval)
- SMTP uses TCP for reliable delivery between mail servers
- SMTP is a client-server protocol, each mail server implements both roles depending on direction:
- when a mail server sends mail to other mail servers, it acts as an SMTP client
- when a mail server receives mail from other mail servers, it acts as an SMTP server
SMTP
SMTP (RFC 5321) (Simple Mail Transfer Protocol):
- much older than HTTP
- legacy technology that possesses certain archaic characteristics:
- restricts the body and headers to ASCII
- requires binary multimedia data to be encoded to ASCII before being sent over SMTP
- requires the corresponding ASCII message to be decoded back to binary after SMTP transport
SMTP uses a store-and-forward model, where messages may pass through multiple intermediate servers before reaching their destination.
If a destination server is temporarily unavailable, sending servers typically retry delivery for some period before returning an error.
Mail message formats
A mail message:
- is defined in RFC 5322
- consists of a header and a body separated by a blank line (
CRLF)
Mail access protocols
Mail servers run on always-on computers managed by an e-mail provider.
E-mail delivery happens in two stages:
- submission and transfer (push protocol):
- a user agent sends the mail to a mail server using SMTP (or HTTP in webmail)
- mail servers then relay the message using SMTP until delivery
- retrieval (pull protocols):
- users retrieve messages from their mailbox using:
- IMAP (Internet Message Access Protocol): keeps mail on server, synchronized across devices
- POP3 (Post Office Protocol v3): downloads mail to the client
- HTTP: used by webmail services
- users retrieve messages from their mailbox using:
Why is the relay system useful?
- if Bob's mail server is temporarily unavailable, Alice's mail server can keep retrying delivery automatically
- this makes e-mail more reliable than direct device-to-device communication
End-to-end email communication flow
Alice wants to send Bob a simple ASCII message:
| Step | Text |
|---|---|
1. Alice |
|
2. Alice's mail client (MUA) |
|
3. SMTP process on Alice's mail server |
|
4. Intermediate mail servers (MTAs) |
|
5. Bob's mail server |
|
6. Bob's mail client (MUA) |
|