SMTP: The mail protocol for the internet

SMTP is used to transfer mail between machines that are continually on the internet, as well as to send mail from a dialup system to another host on the internet. SMTP makes no attempt to authenticate users or systems; the very nature of the network makes such authentication impossible. SMTP transactions occur on port 25. Unlike POP3, commands in SMTP need to be in a particular order. Before any other commands are accepted, the computers need to perform something called handshaking. In this, the originating system (you) says HELO my.fully-resolved.hostname. The other system should give you a similar response. After saying HELO, the user states the origin of the message using
MAIL FROM:sender@host
Secondly, the user states a list of recipients of the message, using
RCPT TO:recipient@host
This command is issued once for each recipient. Then, the DATA command is issued. After this command is issued, all following text is considered to be headers and message body. To terminate a message, a line with just a period is entered. The QUIT command closes the connection.
Here is an example of using SMTP to send a message:
$ telnet 25
Connected to
Escape character is '^]'.
220 ESMTP Sendmail 8.8.7/8.8.6; Wed, 3 Dec 1997 20:20:43 -0500 (EST)
250 Hello dialup [], glad to see you.
250 Sender ok
RCPT TO:user@foo.baz
250 user@foo.baz... Recipient ok
250 Recipient ok
354 Enter mail, end with "." on a line by itself
From: (Pat Gunn)
Subject: Hi there! (test message)

Hi Pat! How are you doing?
I've been bored recently.
See you...
Pat Gunn
250 UAA22108 Message accepted for delivery
221 closing connection
Connection closed by foreign host.

In this example, I sent an email message with a listed from line as, to user@foo.baz and to It is worthy of note that if I deleted the To: line in the headers of my message (the one AFTER DATA), the recipients of my message would not see who the message is to, and thus would be unaware that my message was sent to more than one person. This is the way that Bcc: works in modern Email software. Common headers that you will want to type include:
SMTP is described in RFC788