CSE Roadmap

Specialist tier · about 4 hours · 8 parts

Part 3 of 8 · 1 min read

Basics

Protocols and the single server.

Protocols.

  • SMTP (Simple Mail Transfer Protocol) sends mail from a client to a server and between servers.
  • POP downloads mail to one device and usually deletes it from the server, so only one device sees it.
  • IMAP fetches a message only when opened and keeps it on the server, so many devices can read it. It is the most common choice for personal accounts.
  • HTTPS serves webmail and many mobile clients.

Finding the recipient's server. The sender's server asks DNS for the MX record (mail exchanger) of the recipient's domain. The record lists mail servers with priorities. The lowest number is tried first, and if it fails, the next one.

Attachments. Attachments are encoded as text (Base64) and packed with MIME (Multipurpose Internet Mail Extensions), which lets non-text content travel in email.

The traditional server. Alice sends from her client to her mail server over SMTP. That server finds Bob's server through DNS and hands the message over. Bob's server stores it. When Bob logs in, his client fetches it through IMAP or POP.

In the old design, each message was a file in a directory on one server (a format called Maildir). That works for a few users. At large scale, finding and backing up billions of files is slow, disk speed becomes the limit, and a single disk or server failure loses data. The old protocols also lack threads, labels and search.

Common mistake

Treating email as a request-rate problem. At 115,000 sends a second the rate is modest. The petabytes per day are what break a one-server design.

Check yourself: 1. What does an MX record tell a sender? 2. Why does IMAP suit several devices better than POP? 3. What breaks in the one-server design?