AlgoViz

Design Gmail

hard 60 min

Design a mail service like Gmail.

Where it shows up

The same pattern appears across everyday software.

  • Rules for bulk senders

    Google's sender guidelines ask anyone who sends more than 5,000 messages a day to Gmail accounts for SPF, DKIM and DMARC, and ask all senders to keep reported spam below 0.3%.

  • Conversation breaks

    Gmail's help page says a conversation breaks off when the subject line changes or when it passes 100 emails. So headers alone do not decide.

  • Undo send

    Gmail offers a cancellation period of 5, 10, 20 or 30 seconds. SMTP has no recall, so the only safe way is to wait before sending.

  • Change numbers

    The Gmail API returns a historyId. A client asks for changes since its last one, and does a full sync if the server answers 404 because that point is too old.

  • Open protocol for apps

    JMAP (RFC 8620 and 8621) lets any client sync mail over HTTP with state strings, an open alternative to a private API.

  • Company mail gateways

    Many firms put a filtering service in their MX records. It accepts, scans and relays. The responsibility rule of 250 applies to each hop.

  • Reply-all storms

    A message to a huge list draws hundreds of replies that all say 'remove me'. Systems slow such threads and offer a mute button.