Wiki DE Start in the browser

Wiki › Protocols

E-mail: SMTP, POP3 and IMAP

How a mail travels from the sender via mail servers and MX records into the mailbox, and how it is fetched.

Layer
7 (Anwendung, über TCP)
Standard
RFC 5321, RFC 1939, RFC 9051
See an example
See demo

The path of a mail

  1. Anna writes to ben@schule.example in her mail program and sends via SMTP (port 25) to her mail server.
  2. If Ben is on another server, Anna’s server asks DNS for the MX record of schule.example and delivers the mail there via SMTP.
  3. The mail lies in Ben’s mailbox.
  4. Ben fetches it: via POP3 (port 110, the mail is downloaded and deleted) or via IMAP (port 143, the mail stays on the server, several devices see the same state).

The SMTP dialogue

S: 220 mail.schule.example
C: HELO pc1
S: 250 OK
C: MAIL FROM:<anna@schule.example>
C: RCPT TO:<ben@schule.example>
C: DATA
C: Subject: Hello
C: …
C: .
S: 250 OK
C: QUIT

Every reply starts with a three-digit code: 2xx means success, 5xx a permanent error.

In leyoNET

A server becomes a mail server with domain and mailboxes under Advanced → Services. The mail program on the desktop shows the whole protocol dialogue; in the packet list “Follow TCP stream” reads it line by line.

How to do it in leyoNET

The same text as in the app’s help (F1 key).

E-mail

A mail server accepts messages via SMTP (port 25). They are fetched via POP3 (110, download) or IMAP (143, keep on server). The sender finds the mail server through the MX record in DNS.

See an example

  • Demo “Email: SMTP, POP3, IMAP” in leyoNETDemo “Email: SMTP, POP3, IMAP” in leyoNET
    Email: SMTP, POP3, IMAP

    Anna and Ben share a mail server.

    Anna sends via SMTP, Ben fetches the message via IMAP.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, ready to present.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
SMTP, POP3, IMAP7Small command set, no authentication via TLS

Standards

  • RFC 5321 – Simple Mail Transfer Protocol
  • RFC 1939 – Post Office Protocol – Version 3
  • RFC 9051 – Internet Message Access Protocol (IMAP) – Version 4rev2

Read on

Found a mistake or have an idea? Source of this page on GitHub.