23.2 Parts of a Queued Message
When a message is stored in the queue, it is split into pieces.
Each of those pieces is stored as a separate file in the
queue directory. That is, the header and other information about
the message are stored in one file, while the body (the data)
is stored in another.
All told, six different types of files may appear in the queue directory.
The type of each is denoted by the first two
letters of the filenames. Each filename begins with a single letter
followed by an
The complete form for each filename is
Xf
The
In the following sections we first describe the identifier
that is common to all the queue file parts, then describe each file type in alphabetical order.
The internal details of the 23.2.1 The Queue Identifier
To ensure that new filenames are not the same as the names of
files that may already be in the queue,
sendmail
uses the
following pattern for each new
AA
Here,
If
sendmail
cannot create an exclusive filename
(because a file with that identifier already exists), it clocks the
second
AA start AB second try AC third try ... and so on ~W ~X ~Y last try ~Z failure
If it
never succeeds, the
This
All the files associated with a given mail message share the same
23.2.2 The Data (Message Body) File: dfAll mail messages are composed of a header and a body. When queued, the body is stored in the df file.
Traditionally, the message body could contain only characters that
had the high (most significant) bit turned off (cleared,
set to 0).
But under V8
sendmail
, with a version 2 or higher configuration
file (see
Section 27.5, "The V Configuration Command"
),
the high bit is left as is until delivery (whereupon the
Because the message body can contain sensitive or personal information,
the
There is currently no plan to provide for encryption of 23.2.3 The Lock File (obsolete as of V5.62): lf
When old versions of
sendmail
process a queued message (attempt
to redeliver it)
they create an empty lock file. That lock file is necessary to
signal to other running
sendmail
processes that the mail message
is busy so that they won't try to deliver the message too.
Current versions simply
flock
(2) or
fcntl
(2) the 23.2.3.1 Current style file lockingThe method that sendmail uses to initially create an exclusive lock when first queueing a file is twofold. First it attempts to creat (2) the file with the argument
O_CREAT|O_WRONLY|O_EXCL
If that succeeds,
it then attempts to lock the file. If HASFLOCK (see
Section 18.8.9, HAS...
)
is defined
when
sendmail
is compiled, the file is locked with
flock
(2).
Otherwise, it is locked with a
fcntl
(2)
23.2.3.2 Locks shown when printing the queue
When
mailq
is run (or the
Mail Queue (1 request) -Q-ID- -Size- --Q-Time--- ------Sender/Recipient------ MAA17445* 126 Fri Apr 17 10:17 <gw@wash.dc.gov> <ben@franklin.edu> note 23.2.3.3 Locks can get stuckOccasionally, a file will become locked and remain that way for a long time. One indication of a stuck lock is a series of syslog messages about a given identifier:
Apr 12 00:33:38 ourhost sendmail[641]: AA00614: locked Apr 12 01:22:14 ourhost sendmail[976]: AA00614: locked Apr 12 02:49:23 ourhost sendmail[3251]: AA00976: locked Apr 12 02:49:51 ourhost sendmail[5977]: AA00614: locked Apr 12 03:53:05 ourhost sendmail[9839]: AA00614: locked
An occasional lock message, such as
root 5338 160 -AA00614 To wash.dc.gov (sendmail)
This shows that the queued mail message, whose identifier is
23.2.4 The ID Creation File (obsolete as of V5.62): nf
Old versions of
sendmail
used an
23.2.5 The Queue Control File: qf
A queued mail message is composed of two primary parts. The
In addition to the header, the
The
Here is an example of a version 1 (for V8.8
sendmail
)
V1 T826845694 K0 N0 P30016 I7/4/20 $_you@localhost MDeferred: Host wash.dc.gov is down Syou@your.domain RPFD:george@wash.dc.gov RPFD:jefferson H?P?Return-Path: you@your.domain HReceived: (from you@your.domain) by your.domain (8.8.4/8.8.4) id QAA06571 for george@wash.dc.gov; Thu, 14 Mar 1996 16:21:34 -0700 (MST) H?D?Date: Thu, 14 Mar 1996 16:21:34 -0700 (MST) H?F?From: Your Name <you@your.domain> H?x?Full-Name: Your Name H?M?Message-Id: <199603142321.QAA06571@your.domain> HSubject: foo .
This fictional 23.2.6 The Temporary qf Rewrite Image: tf
When processing a queued message, it is often necessary for
sendmail
to modify the contents of the
To prevent damage to the original
After the
cannot rename(tfAA00000, qfAA00000), df=dfAA00000
Failure to rename is an unusual, but serious, problem:
A queued message
has been processed, but its 23.2.7 The Transcript File: xfA given mail message may be destined for many recipients, requiring different delivery agents. During the process of delivery, error messages (such as "User unknown" and "Permission denied") can be printed back to sendmail by each delivery agent.
While calling the necessary delivery agents,
sendmail
saves all the error messages it receives in a temporary file.
The name of that temporary file begins with the letters | |||||||||||||||||||||
|