Simple Mail Transfer Protocol
Mail RFCs (1)
- SMTP RFC5321 (obsoletes RFC2821)
- SMTP Authentication RFC2554
- SMTP STARTTLS RFC2487
- Message Submission RFC4409
Mail RFCs (2)
- Message Header RFC5322 (obsoletes RFC5322)
- MIME 1 Body Format RFC2045
- MIME 2 Media Types RFC2046
- MIME 3 Header Extension RFC2047
- MIME 4 Registration RFC4289 (旧 RFC2048)
- MIME 5 Examples RFC2049
SMTP Server
Session Initialion
- C->S Connect TCP 25
- S->C 220 greeting message
Client Initiation
- C->S EHLO Client Identiy
- S->C 250 Server Idenity + ESMTP Capabilities
Mail Transactions (1)
- C->S MAIL From: sender
- S->C 250 Ok
- C->S RCPT To: recipient
- S->C 250 Ok
Mail Transactions (2)
- C->S DATA
- S->C 354 End data with .
- C->S (message)
- C->S .
- S->C 250 Ok
Session Close
- C->S QUIT
- S->C 221 Bye
Debugging Commands
- EXPN ... Expand (list address)
- VRFY ... Verify (e-mail address)
- almost always disabled
SMTP Relay
- Relay to internal SMTP servers
- Relay to non-IP email system
- Historical ... @BITNET
- X.400 MHS
- From internal users to the Internet
Received headers
- When forwarding a message, a gateway MUST prepend a Received: line
- but it MUST NOT alter in any way a Received: line that is already in the header section.
Other SMTP Commands
- HELO ... Older EHLO
- RSET (reset)
- HELP/NOOP
SMTP Response Code (1)
- 2yz ... Positive Completion reply
- 3yz ... Positive Intermediate reply
- 4yz ... Transient Negative Completion reply
- 5yz ... Permanent Negative Completion reply
SMTP Response Code (2)
- x0z Syntax related
- x1z Informational
- x2z Connections related
- x5z Mail system related
Reply continuation
- Example:
250-First line 250-Second line 250-234 Text beginning with numbers 250 The last line
Command-Reply Sequences
- See RFC5321
Size and Timeouts
- See RFC5321
Locating Servers
- DNS MX record
- or A/AAAA record
SMTP Authentication
- SMTP AUTH (PLAIN)
- C->S AUTH PLAIN (base64 encoded auth info)
- S->C 235 2.7.0 Authentication successful
- use STARTTLS (TLS)
Outbound Port 25 blocking
- ISP users can send Spam directly to an outer SMTP server
- Prevent this by blocking TCP port 25
- Mobile users can use mail submission agent (port 587) with authentication
Quiz of the day
- What is the number of TCP port in following message agents
- Message Transfer Agent
- Message Submission Agent
Homework
- Use "telnet is01 25" to connect our mail server and send yourself an e-mail message.
- Record the transaction and view the source of the message you've received.
- Include both the transaction and the message source in your report.