Полезная информация

sendmail

sendmailSearch this book
Previous: 13.3 Testing the OptionsChapter 13
Setting Options
Next: 13.5 Things to Try
 

13.4 Sending Mail

The client.cf file is now at a point in its development at which it can be used for sending mail. The mail that it generates will cause problems in a few ways, but we will gloss over those illegalities for now and deal with them in the next chapter. You can send mail to yourself with sendmail like this:

% /usr/lib/sendmail -Cclient.cf you

After you enter this command, sendmail pauses and waits for you to enter the email message you want to send. Enter a To: header line, a Subject: header line, a blank line (to separate the header from the body), and a brief message to yourself, and conclude by entering a dot on a line by itself:

To: you
Subject: testing

testing
.

Your message is now forwarded to the mail hub machine, where (if all has gone well) it is delivered. Using your favorite MUA, read the message you just sent and save it to a file. That file will look something like this:

From you@mail.us.edu Fri Dec 13 05:47:47 1996
Return-Path: <you@mail.us.edu>
Received: from here.us.edu (you@here.us.edu [123.45.67.8]) by mail.us.edu 
(8.8.4/8.8.4) with ESMTP id FAA13451 for <you>; Fri, 13 Dec 1996 05:47:46 -0700
Date: Fri, 13 Dec 1996 05:47:46 -0700
From: you@mail.us.edu
Message-Id: <199509091247.FAA13451@mail.us.edu>
To: you
Subject: testing

testing

The first thing to notice in this saved message is that several header lines have been added. You gave sendmail only two lines, a To: and a Subject:, when you ran it, but now there are eight header lines.

These header lines were added by the hub machine. Because they were added by the hub and not by your local machine, a few of them are illegal. The Received: header, for example, shows only that the hub received the message from the local machine. There is no indication (other than by implication) that the local machine received it in the first place.

Another problem is the Message-ID: header. Every email message is supposed to have a message identifier that is guaranteed unique world wide. Part of that identifier is supposed to be the name of the originating machine (your local machine). In the above header, however, it contains the name of the mail hub, mail.us.edu.

We'll fix these problems when we cover headers in the next chapter.


Previous: 13.3 Testing the OptionssendmailNext: 13.5 Things to Try
13.3 Testing the OptionsBook Index13.5 Things to Try