Simple Mail Transfer Protocol |
Simple Mail Transfer Protocol (SMTP) is the de facto standard for email transmission across the Internet.
SMTP is a relatively simple, text-based protocol, where one or more recipients of a message are specified (and in most cases verified to exist) and then the message text is transferred. It is quite easy to test a SMTP server using the Telnet program. SMTP uses Transmission Control Protocol computer port 25. To determine the SMTP server for a given domain name, the MX record (Mail eXchange) DNS record is used.
SMTP started becoming widely used in the early 1980s. At the time, it was a complement to UUCP which was better suited to handle e-mail transfers between machines that were intermittently connected. SMTP, on the other hand, works best when both the sending and receiving machines are connected to the network all the time.
Sendmail was one of the first (if not the first) mail transfer agent to implement SMTP. As of 2001 there are at least 50 programs that implement SMTP as a client (sender of messages) or a server (receiver of messages). Some other popular SMTP server programs include Philip Hazel s exim, IBM s Postfix (software), Daniel J. Bernstein s qmail, and Microsoft Exchange Server.
Since this protocol started out as purely ASCII text-based, it did not deal well with binary files. Standards such as MIME were developed to encode binary files for transfer through SMTP. Today, most SMTP servers support the 8BITMIME extension, permitting binary files to be transmitted almost as easily as plain text.
SMTP is a push protocol that does not allow one to pull messages from a remote server on demand. To do this a mail client must use Post Office Protocol or Internet Message Access Protocol. Another SMTP server can trigger a delivery in SMTP using ETRN.
= Example SMTP communication =
After establishing a connection between the sender (the client) and the receiver (the server), the following is a legal SMTP session. In the following conversation, everything sent by the client is prefaced with C: and everything sent by the server is prefaced with S: . On most computer systems, a connection can be established using the Telnet command on the sending machine, for example
telnet www.example.com 25
which opens an SMTP connection from the sending machine to the host www.example.com.
S: 220 www.example.com ESMTP Postfix C: HELO mydomain.com S: 250 Hello mydomain.com C: MAIL FROM: S: 250 Ok C: RCPT TO: S: 250 Ok C: DATA S: 354 End data with . C: Subject: test message C: From: C: To: C: C: Hello, C: This is a test. C: Goodbye. C: . S: 250 Ok: queued as 12345 C: QUIT S: 221 Bye
Although optional and not shown above, nearly all clients ask the server which SMTP extensions the server supports by using the EHLO greeting. These clients use HELO only if the server does not respond to EHLO.
= SMTP implementations =
[http://james.apache.org/ Apache James]
= SMTP security and spamming =
One of the limitations of the original SMTP is that it has no facility for authentication of senders. Therefore the SMTP-AUTH extension was defined.
In spite of this, E-mail spamming is still a major problem. Modifying SMTP extensively, or replacing it completely, is not believed to be practical, due to the network effects of the huge installed base of SMTP. Internet Mail 2000 is one such proposal for replacement.
For this reason, there are a number of proposals for sideband protocols that will assist SMTP operation. The Anti-Spam Research Group of the IRTF is working on a number of Email authentication and other proposals for providing simple source authentication that is flexible, lightweight, and scalable.
= SMTP Commands =
== Essential Commands ==
These commands are required by RFC 821:
HELO - Identify the SMTP sender to the SMTP receiver. (Obsoleted by RFC 2821)
EHLO - Identify the SMTP sender to the SMTP receiver under Extended SMTP.
MAIL - Set the envelope return path (sender) and clear the list of envelope recipient addresses.
RCPT - Add one address to the list of envelope recipient addresses.
DATA - Consider the lines following the command to be e-mail from the sender.
RSET - Reset the envelope.
NOOP - Ask the receiver to send a valid reply (but specify no other action).
QUIT - Ask the receiver to send a valid reply, and then close the transmission channel.
== Optional Commands ==
These commands are optional but are frequently implemented:
HELP - Ask the receiver to send helpful information to the sender.
VRFY - Ask the receiver to confirm that a user has been identified.
EXPN - Ask the receiver to confirm that a mailing list has been identified.
== Obsolete Commands ==
These commands are not commonly used and are obsoleted by RFC 2821:
SEND - Deliver e-mail to one or more work stations.
SOML - Deliver e-mail to one or more work stations or recipients if the user is not active.
SAML - Deliver e-mail to one or more work stations and recipients if the user is not active.
TURN - Ask the receiver to send a valid reply and then become the SMTP sender, or else ask the receiver to send a refusal reply and remain the SMTP receiver.
=SMTP Status Codes=
==Temporary Errors==
These indicate a temporary error and tell the sending system to retry delivery later:
421 Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)
450 Requested mail action not taken: mailbox unavailable (E.g., mailbox busy)
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
==Permanent Errors==
These indicate a permanent error and tell the sending system to bounce the message:
500 Syntax error, command unrecognized (This may include errors such as command line too long)
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable (E.g., mailbox not found, no access)
551 User not local; please try
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed (E.g., mailbox syntax incorrect)
554 Transaction fail
==Others==
The other codes provide you with helpful information about what is happening with your message:
211 System status, or system help reply
214 Help message (Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user)
220 Service ready
221 Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to
354 Start mail input; end with . (a dot)
=SMTP Enhanced Status Codes=
These codes are defined in RFC 3463 and can be used in conjunction with RFC 2034.
2.X.X Success 4.X.X Persistent Transient Failure 5.X.X Permanent Failure
X.0.X Other or Undefined Status X.0.0 Other undefined Status
X.1.X Addressing Status X.1.0 Other address status X.1.1 Bad destination mailbox address X.1.2 Bad destination system address X.1.3 Bad destination mailbox address syntax X.1.4 Destination mailbox address ambiguous X.1.5 Destination mailbox address valid X.1.6 Mailbox has moved X.1.7 Bad sender s mailbox address syntax X.1.8 Bad sender s system address
X.2.X Mailbox Status X.2.0 Other or undefined mailbox status X.2.1 Mailbox disabled, not accepting messages X.2.2 Mailbox full X.2.3 Message length exceeds administrative limit. X.2.4 Mailing list expansion problem
X.3.X Mail System Status X.3.0 Other or undefined mail system status X.3.1 Mail system full X.3.2 System not accepting network messages X.3.3 System not capable of selected features X.3.4 Message too big for system
X.4.X Network and Routing Status X.4.0 Other or undefined network or routing status X.4.1 No answer from host X.4.2 Bad connection X.4.3 Routing server failure X.4.4 Unable to route X.4.5 Network congestion X.4.6 Routing loop detected X.4.7 Delivery time expired
X.5.X Mail Delivery Protocol Status X.5.0 Other or undefined protocol status X.5.1 Invalid command X.5.2 Syntax error X.5.3 Too many recipients X.5.4 Invalid command arguments X.5.5 Wrong protocol version
X.6.X Message Content or Media Status X.6.0 Other or undefined media error X.6.1 Media not supported X.6.2 Conversion required and prohibited X.6.3 Conversion required but not supported X.6.4 Conversion with loss performed X.6.5 Conversion failed
X.7.X Security or Policy Status X.7.0 Other or undefined security status X.7.1 Delivery not authorized, message refused X.7.2 Mailing list expansion prohibited X.7.3 Security conversion required but not possible X.7.4 Security features not supported X.7.5 Cryptographic failure X.7.6 Cryptographic algorithm not supported X.7.7 Message integrity failure
= See also =
=Related RFCs =
=External links=
|
|