Skip to main content

Appendix D. Scenarios

This appendix presents typical SMTP transaction scenarios to illustrate protocol operation.

D.1. A Typical SMTP Transaction Scenario

Scenario: alice@client.example sends mail to bob@server.example

# Connection establishment
C: `<establishes TCP connection to server.example port 25>`
S: 220 server.example ESMTP Postfix

# Client greeting
C: EHLO client.example
S: 250-server.example
S: 250-SIZE 52428800
S: 250-8BITMIME
S: 250-STARTTLS
S: 250 HELP

# Mail transaction
C: MAIL FROM:``<alice@client.example>``
S: 250 2.1.0 Ok

C: RCPT TO:``<bob@server.example>``
S: 250 2.1.5 Ok

# Message content
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>

C: From: Alice ``<alice@client.example>``
C: To: Bob ``<bob@server.example>``
C: Subject: Hello
C: Date: Wed, 24 Dec 2024 10:00:00 +0000
C:
C: Hi Bob,
C:
C: This is a test message.
C:
C: Best regards,
C: Alice
C: .

S: 250 2.0.0 Ok: queued as A1B2C3D4E5

# Session termination
C: QUIT
S: 221 2.0.0 Bye

D.2. Aborted SMTP Transaction Scenario

Scenario: Sender aborts transaction mid-way

S: 220 server.example ESMTP

C: EHLO client.example
S: 250 server.example

C: MAIL FROM:``<sender@client.example>``
S: 250 Ok

C: RCPT TO:``<recipient1@server.example>``
S: 250 Ok

C: RCPT TO:``<recipient2@server.example>``
S: 550 5.1.1 User unknown

# Sender decides to abort and start over
C: RSET
S: 250 Ok

# Start new transaction
C: MAIL FROM:``<sender@client.example>``
S: 250 Ok

C: RCPT TO:``<recipient3@server.example>``
S: 250 Ok

C: DATA
S: 354 Start mail input

C: (message content)
C: .
S: 250 Ok: queued as XYZ123

C: QUIT
S: 221 Bye

D.3. Relayed Mail Scenario

Scenario: Mail from alice@origin.example to bob@final.example via relay.example

Step 1: origin.example → relay.example

C: EHLO origin.example
S: 250 relay.example

C: MAIL FROM:``<alice@origin.example>``
S: 250 Ok

C: RCPT TO:``<bob@final.example>``
S: 250 Ok (relay accepts to forward)

C: DATA
S: 354 Start mail input
C: (message)
C: .
S: 250 Ok: queued for relay

Step 2: relay.example → final.example

# relay.example now acts as client
C: EHLO relay.example
S: 250 final.example

C: MAIL FROM:``<alice@origin.example>``
S: 250 Ok

C: RCPT TO:``<bob@final.example>``
S: 250 Ok

C: DATA
S: 354 Start mail input
C: Received: from origin.example by relay.example; ...
C: (original message)
C: .
S: 250 Ok: delivered to bob

C: QUIT
S: 221 Bye

D.4. Verifying and Sending Scenario

Scenario: Client verifies address before sending

S: 220 server.example ESMTP

C: EHLO client.example
S: 250 server.example

# Verify recipient exists
C: VRFY bob
S: 250 Bob Smith ``<bob@server.example>``

# Now send mail
C: MAIL FROM:``<alice@client.example>``
S: 250 Ok

C: RCPT TO:``<bob@server.example>``
S: 250 Ok

C: DATA
S: 354 Start mail input
C: (message)
C: .
S: 250 Ok

C: QUIT
S: 221 Bye

Alternative: VRFY disabled for security

C: VRFY bob
S: 252 2.5.2 Cannot VRFY user, but will accept message

# Client proceeds anyway
C: MAIL FROM:``<alice@client.example>``
S: 250 Ok
...