Email, SMTP, IMAP

Email

Three major components:

  • user agents
  • mail servers
  • simple mail transfer protocol: SMTP

User Agent

  • aka “mail reader”
  • composing, editing, reading mail messages
  • e.g., Outlook, iPhone mail client
  • outgoing, incoming messages stored on server

E-mail: mail servers

mail servers:

  • mailbox contains incoming messages for user
  • message queue of outgoing (to be sent) mail messages

SMTP protocol between mail servers to send email messages

  • client: sending mail server
  • ”server”: receiving mail server

SMTP RFC (5321)

  • uses TCP to reliably transfer email message from client (mail server initiating connection) to server, port 25
    • direct transfer: sending server (acting like client) to receiving server
  • 3 phases of transfer
    • SMTP handshaking (greeting)
    • SMTP transfer of messages
    • SMTP closure
  • command/response interaction (like HTTP)
    • commands: ASCII text
    • response: status code and phrase

Example:

SMTP vs HTTP

  • HTTP: client pull

  • SMTP: client push

  • both have ASCII command/response interaction, status codes

  • HTTP: each object encapsulated in its own response message

  • SMTP: multiple objects sent in multipart message

  • SMTP uses persistent connections

  • SMTP requires message (header & body) to be in 7-bit ASCII

  • SMTP server uses CRLF.CRLF to determine end of message

Mail message format

  • header
  • body
    • ASCII characters only

Retrieving email: mail access protocols

  • SMTP: delivery/storage of e-mail messages to receiver’s server used 2x
  • mail access protocol: retrieval from server
    • IMAP: Internet Mail Access Protocol [RFC 3501]: messages stored on server, IMAP provides retrieval, deletion, folders of stored messages on server
  • HTTP: gmail, Hotmail, Yahoo! Mail, etc. provides web-based interface on top of SMTP (to send), IMAP (or POP) to retrieve e-mail messages