Most users do not run sendmail directly. Instead, they use one of many mail user agents (MUAs) to compose a mail message. Those programs invisibly pass the mail message to sendmail, creating the appearance of instantaneous transmission. The sendmail program then takes care of delivery in its own seemingly mysterious fashion.
Although most users don't run sendmail directly, it is perfectly legal to do so. You, like many system managers, may need to do so to track down and solve mail problems.
Here's a demonstration of one way to run sendmail by hand. First create a file named sendstuff with the following contents:
This is a one line message.
Second, mail this file to yourself with the following command line,
where you
is your login name:
%/usr/lib/sendmail
you
<sendstuff
Here, you run sendmail directly by specifying its full pathname.
[1]
When you run sendmail, any command-line arguments
that do not begin with a -
character are considered
to be the names of the people to whom you are sending the mail message.
[1] That path may be different on your system. If so, substitute the correct pathname in all the examples that follow. For example, try looking for sendmail in /usr/sbin or /usr/ucblib.
The <sendstuff
sequence causes the contents of the file that you
have created (sendstuff) to be redirected into the
sendmail program. The sendmail program
treats everything it reads from its standard input (up to the
end of the file) as the mail message to transmit.
Now view the mail message that you just sent. How you do this will vary. Many users just type mail to view their mail. Others use the mh(1) package and type inc to receive and show to view their mail. No matter how you normally view your mail, save the mail message that you just received to a file. It will look something like this:
From [email protected] Fri Dec 13 08:11:44 1996 Received: (from you@localhost) by Here.US.EDU (8.8.4/8.8.4) id AA04599 for you; Fri, 13 Dec 96 08:11:44 -0700 Date: Fri, 13 Dec 96 08:11:43 From: [email protected] (Your Full Name) Message-Id: <[email protected]> To: you may be Apparently-To: This is a one line message.
The first thing to note is that this file begins with seven lines of text that were not in your original message. Those lines were added by sendmail and your local delivery program and are called the header.
The last line of the file is the original line from your sendstuff file. It is separated from the header by one blank line. The body of a mail message comes after the header and consists of everything that follows the first blank line (see Figure 1.1).
Ordinarily, when you send mail with your MUA, the MUA adds a header and feeds both the header and the body to sendmail. This time, however, you ran sendmail directly and supplied only a body; the header was added by sendmail.