Email Flashcards
Application architecture (Three major components) of Email
- Mail servers
- User Agents
- “Simple Mail Transfer Protocol” (SMTP)
Mail Servers
- Composition of a mail server
- Mailbox contains incoming messages for users
- Message queue of outgoing (to be sent) mail messages
- Messages are sent between mail servers using SMTP
- Mail servers play both a “client” role and a “server” role
- “Server” role: receive emails from an upstream server (or UA)
- “Client” role: sending emails to a downstream server
User Agent
- “Mail reader”
- Outlook, Thunderbird, iPhone mail client, etc.
- Used to compose, edit, send, read… mail messages
- Both outgoing and incoming messages are stored on the associated server, not on the UA itself
Simple Mail Transfer Protocol [RFC 5321]
- Principal application-layer protocol for Internet electronic mail
- Older than HTTP!
- RFC 5321 published in 1982, but SMTP was used before that too
- Still in widespread use, despite its age
SMTP archaic characteristics
- Body must be simple 7-bit ASCII
- This made sense in the 1980s when throughput was scarce
- However, with the advent of the multimedia era, sending images, audio, etc. became more common
- Binary multimedia data has to be encoded to ASCII before sending
- Decoded on the receiver side too
SMTP (Transport, Three phases of transfer,Command/response style)
- Uses TCP to reliably transfer email message from mail server to mail server
- Runs over TCP port 25
- Direct transfer between sending server and receiving server
- Three phases of transfer:
- Handshake (greeting)
- Transfer of messages
- Close
- Command/response style interaction (like HTTP)
- Commands: ASCII text
- Response: status code + text
Scenario:
Alice wants to send a message to Bob
1) Alice uses UA to compose message “to” bob@someschool.edu
2) Alice’s UA sends message to her mail server; message placed in message queue
3) Client side of SMTP opens TCP connection with Bob’s mail server
4) SMTP client sends Alice’s message over the TCP connection; let’s assume that Bob’s mail server queue is full and rejects the message
5) Alice’s mail server retries every 30 minutes until it’s successful; the message is eventually delivered
6) Bob’s mail server places the message in Bob’s mailbox
7) Bob invokes his user agent to read message
Intermediate Servers
- Sending does not necessarily use intermediate mail servers
- Even if the mail servers are on the other side of world
- Example: Alice’s server is in Lancaster, Bob’s server is in New York: direct TCP connection between the two servers
- If Bob’s mail server is not receiving additional messages, the message will remain on Alice’s mail server in Lancaster
- It does not get placed in an intermediate server
Sample SMTP Interaction
Much like face-to-face communication!
Comparison to HTTP
- HTTP: pull
- SMTP: push
- Both have ASCII command/response interaction, status codes
- HTTP: no format restrictions
- SMTP: enforces 7-bit ASCII format
- HTTP: each “object” is encapsulated in its own response message
- SMTP: multiple objects sent in multipart message
Mail Message Format
Mail Access Protocols
SMTP: delivery to receiver’s server
* Mail access protocol: subsequent retrieval from server
* POP: Post Office Protocol [RFC 1939]: authorisation, download
* IMAP: Internet Mail Access Protocol [RFC 1730]: more sophisticated, e.g. allows manipulation of stored messages on server
* HTTP: GMail, Hotmail, Yahoo! Mail, etc.
POP3 example
POP3 contd.
- Previous example used “download and delete” mode
- Bob cannot re-read e-mail if he changes client, as it has been deleted
- “download-and-keep” mode allows copies of messages to be kept on different clients
- POP3 is stateless across sessions
- Simple protocol, but limited functionality
- Still in widespread use
IMAP
- Can keep and manipulate all messages at the server
- Allows users to organise messages in folders
- With POP3 this would be achieved locally, on the client-side
- However, IMAP allows this to be done remotely
- Keeps user state across sessions:
- Names of folders and mappings between message IDs and folder names
- IMAP also allows parts of a message to be retrieved
- Useful with low bandwidth connections
- Avoid fetching attachments, for example