Appendix D. Scenarios (场景示例)
本附录提供了几个典型SMTP事务的完整示例场景。
D.1. A Typical SMTP Transaction Scenario (典型SMTP事务场景)
完整的成功邮件传输:
S: 220 smtp.example.com ESMTP Postfix
C: EHLO client.example.com
S: 250-smtp.example.com
S: 250-SIZE 52428800
S: 250-8BITMIME
S: 250 HELP
C: MAIL FROM:<[email protected]>
S: 250 2.1.0 Ok
C: RCPT TO:<[email protected]>
S: 250 2.1.5 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: [email protected]
C: To: [email protected]
C: Subject: Test Message
C: Date: Mon, 22 Dec 2025 10:00:00 +0000
C:
C: This is a test message.
C: .
S: 250 2.0.0 Ok: queued as 12345
C: QUIT
S: 221 2.0.0 Bye
D.2. Aborted SMTP Transaction Scenario (中止的SMTP事务场景)
使用RSET中止事务:
S: 220 smtp.example.com ESMTP
C: HELO client.example.com
S: 250 smtp.example.com
C: MAIL FROM:<[email protected]>
S: 250 Ok
C: RCPT TO:<[email protected]>
S: 550 No such user here
C: RSET
S: 250 Reset OK
C: QUIT
S: 221 Bye
D.3. Relayed Mail Scenario (中继邮件场景)
邮件通过中继服务器:
步骤1: 客户端到中继服务器
C: EHLO client.example.com
S: 250 relay.example.com
C: MAIL FROM:<[email protected]>
S: 250 Ok
C: RCPT TO:<[email protected]>
S: 250 Ok (will relay)
C: DATA
...
S: 250 Ok: queued for relay
步骤2: 中继服务器到最终服务器
C: EHLO relay.example.com
S: 250 remote.example.org
C: MAIL FROM:<[email protected]>
S: 250 Ok
C: RCPT TO:<[email protected]>
S: 250 Ok
C: DATA
...
S: 250 Ok: delivered
D.4. Verifying and Sending Scenario (验证和发送场景)
使用VRFY验证地址:
S: 220 smtp.example.com ESMTP
C: EHLO client.example.com
S: 250 smtp.example.com
C: VRFY Jones
S: 250 Fred Jones <[email protected]>
C: MAIL FROM:<[email protected]>
S: 250 Ok
C: RCPT TO:<[email protected]>
S: 250 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
...
C: .
S: 250 Ok
C: QUIT
S: 221 Bye
这些场景展示了SMTP协议在各种实际情况下的使用方式。