next up previous
Next: Receiving Mail (POP) Up: Sending Mail (SMTP) Previous: The RCPT Command

The DATA Command

After starting the mail conversation and telling the server who the recipient or recipients are, you use the DATA command to send the body of the message. The syntax for the DATA command is very simple:

DATA

After you get the standard 354 response, send the body of the message followed by a line with a single period to indicate that the body is finished. When the end of message line is received, the server will respond with a 250 reply code.

Note The body of the message can also include several header items like Date, Subject, To, Cc, and From.

Reporting Undeliverable Mail

The mail server is responsible for reporting undeliverable mail, so you may not need to know too much about this topic. However, this information may come in handy if you ever write/run a list service or if you send a message from a temporary account.

An endless loop happens when an error notification message is sent to a non-existent mailbox. The server keeps trying to send a notification message to the reverse-path specified in the MAIL command.

The answer to this dilemma is to specify an empty reverse path in the MAIL command of a notification message like this:

MAIL FROM:<>

An entire mail session that delivers an error notification message might look like the following:

>MAIL FROM:<>
<250 ok
>RCPT TO:<@HOST@cs.cf.ac.uk>
<250 ok
>DATA
<354 send the mail data, end with .
>Date: 12 May 99 10:55:51
>From: dave@cs.cf.ac.uk
>To: someone@cs.cf.ac.uk
>Subject: Problem delivering mail.


your message to someone@cs.cf.ac.uk was not
delivered.


   cs.cf.ac.uk said this:
        "550 No Such User"
.
<250 ok


next up previous
Next: Receiving Mail (POP) Up: Sending Mail (SMTP) Previous: The RCPT Command
Dave Marshall
9/28/2001