Simple Mail Transfer Protocol

Reprinted by permission from Matt Mussleman

Table of Contents

SMTP Commands and Meanings

Command Name Definition Description Status
HELO Introduction    
EHLO Introduction (extended SMTP mode)    
RSET System Reset    
EXPN Expand Mailing List SMTP server returns address of final destination for any mail addressed to the specified address. Often disabled due to security risks. This command allows potential spammers to determine which addresses are valid on this host.
NOOP No Operation A null command. Does nothing.  
VERB Verbose mode Server responds to message send with a much more verbose, but non-standard, status dialogue.  
MAIL Specify Mail Sender    
TURN Mail Turn SMTP server begins dequeueing queued mail for the specified domain to the host which opened the current SMTP session. Usually disabled due to risk of dequeueing mail to an unauthorized host. See ETRN.
ETRN Extended Turn SMTP server looks up the primary MX record for the domain specified and begins dequeueing all queued mail to that host. Preferred instead of TURN. Not available on all SMTP implementations.
RCPT Specify Mail Recipient    
HELP      
DATA Specify Message Content    
VRFY Verify Address SMTP server acknowledges whether specified address is valid. Often disabled for security to avoid helping potential spammers generate address lists.
DSN Delivery Status Notifications    
QUIT Quit End SMTP Session  


SMTP Messages

Format:
Example Description
EHLO sender's domain
MAIL FROM: sender address
	[RET={FULL | HDRS}] [ENVID=envid]
RCPT TO: recipient address
	[NOTIFY={NEVER,SUCCESS,FAILURE,DELAY}]
	[ORCPT=recipient]
DATA
From: sender name <sender address>
To: recipient name <recipient address>
Subject: subject
Date: date

message body here

.

RET (specify whether to return full message or headers
	in case of failure)
ORCPT (specify receipt recipient)

Optional. If omitted, defaults to sender specified above
To, Subject, and Date also optional.





End with a single period on a line by itself.

Example:
220 arjuna.mindflip.com ESMTP Sendmail 8.9.3/8.9.3; Mon, 11 Oct 1999 04:22:25 GMT
HELO mindflip.com
250 arjuna.mindflip.com Hello arjuna.mindflip.com [206.50.17.92], pleased to meet you 
MAIL FROM: matt@arjuna.mindflip.com
250 matt@arjuna.mindflip.com... Sender ok 
RCPT TO: mindflip@mindflip.com
250 mindflip@mindflip.com... Recipient ok 
DATA 354 Enter mail, end with "." on a line by itself
From: Matt 
To: Mindflip User 
Subject: Just saying hi
Date: 11 Oct 1999
I just wanted to say Hi.
.
250 EAA80467 Message accepted for delivery

ETRN Transactions

Format:

Format Description
EHLO domain
ETRN domain
EHLO will cause the server to do a reverse DNS lookup to verify sender.
After ETRN, server looks up primary MX for domain, and dequeues mail.  

Example:
220 arjuna.mindflip.com ESMTP Sendmail 8.9.3/8.9.3; Mon, 11 Oct 1999 04:16:25 GMT
EHLO mindflip.com
 250-arjuna.mindflip.com Hello nakula [206.50.17.90], pleased to meet you
ETRN mindflip.com
250 Queuing for node mindflip.com started

For More Information

RFC-821, Simple Mail Transfer Protocol
Original specifications of the SMTP protocol.
}