E-mail

Components

The Internet mail system has three major elements:

  1. MUA (mail user agents)
    • allow users to read, reply to, forward, save, and compose messages
  2. MTA (mail transfer agents) or mail servers
    • core of the e-mail infrastructure
  3. 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):

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:

Mail access protocols

Mail servers run on always-on computers managed by an e-mail provider.

E-mail delivery happens in two stages:

  1. 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
  2. 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

Why is the relay system useful?

End-to-end email communication flow

Alice wants to send Bob a simple ASCII message:

End-to-end email communication flow

Step Text

1. Alice

  • opens her mail client (MUA)
  • provides Bob's e-mail address (bob@someschool.edu)
  • composes a message
  • instructs the user agent to send the message

2. Alice's mail client (MUA)

  • sends the message to her outgoing mail server using SMTP
  • where it is placed in a message-outgoing queue

3. SMTP process on Alice's mail server

  • retrieves the message from the queue
  • looks up Bob's mail server using DNS MX records
  • opens a TCP connection to the destination SMTP server (or an intermediate relay)
  • sends Alice's message into the TCP connection after some initial SMTP handshaking

4. Intermediate mail servers (MTAs)

  • may store and forward the message through multiple hops
  • each MTA receives the message via SMTP and relays it closer to Bob's mail server

5. Bob's mail server

  • receives the message via SMTP
  • places the message in Bob's mailbox

6. Bob's mail client (MUA)

  • connects to Bob's mail server when Bob checks his mail at his convenience
  • retrieves or synchronizes messages using IMAP (or downloads them using POP3 or HTTP)
  • displays the message to Bob

Previous HTTP All ⏎ Next DNS

A Kemar Joint