Labs / Speaking Protocols / HTTP, TLS & mail

Lab 4 of 4 · HTTP, TLS & mail

The path of an email

How email works: send one by hand over SMTP and follow it between servers.

Open this lab Pro 5 steps

The idea

Follow one email from aliceLaptop to bob's inbox, server by server. Each domain runs its own mail server, mailNorth for north.lab and mailSouth for south.lab: postfix speaks SMTP, dovecot speaks IMAP, and bob reads on bobLaptop.

Two senders, two recipients
Two senders, two recipients
Hand to hand
Hand to hand

Steps

  1. The MX record names a domain's mail server

    A sender knows only an address like bob@south.lab, never which machine takes south.lab's mail. So a mail server asks DNS where mail for the domain goes. Ask the same question from aliceLaptop.

    aliceLaptop:~# dig MX south.lab +noall +answer
    aliceLaptop:~# dig +short south.lab
    aliceLaptop:~# dig +short mailSouth.lab
  2. SMTP typed by hand

    Every mail server in the world must understand every other, so SMTP stays simple: text lines and three-digit replies on Port 25. Hand mailNorth a message for bob, line by line, and read each reply before the next.

    aliceLaptop:~# nc mailNorth.lab 25

Pro

3 more steps in the app

  1. One mail server relays to the next
  2. Reading mail over IMAP
  3. A mail server is not an open relay
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab