The precedence of a mail message determines its position among other messages in the queue when the queue is processed. Precedence, as a header line, also defines whether or not a bounced message should be returned to the sender. Precedences are not hard-coded into sendmail. Instead, they need to be declared in the configuration file. The typical declarations, and the ones we will use, look like this:
Pspecial-delivery=100 Pfirst-class=0 Plist=-30 Pbulk=-60 Pjunk=-100
These lines use the P
(precedence) configuration command.
Like all configuration
commands, the P
must begin the line. It is followed
by a name, an equal sign, and a value. The general form
looks like this:
Pname
=value
There are only five possibilities for name
that are legal:
special-delivery
This mail message needs to be processed before any others. This
precedence is effective only when the message is being delivered
from the queue.
first-class
Unless otherwise declared with a Precedence:
header,
the message is first-class
by default.
list
The message originated as part of a mailing list. It should be
deferred until other more important mail has been processed
from the queue.
bulk
The message is a broadcast, like a mailing list but less important.
If the message can't be delivered, the message body is discarded
from the bounced mail.
junk
Absolutely worthless mail. Test messages and mail from some
programs fall into this category. Like bulk
, the message
body is discarded from the bounced mail.
The value
assigned to each name
is somewhat arbitrary.
The ones that we use are common. As you gain familiarity with the
queue and mailing lists, you may want to adjust these values.
In general, the higher the number, the higher the precedence.
By convention, formal first-class mail has a precedence of zero, with
positive numbers used
for high-precedence
mail and negative numbers
used for various kinds of bulk mail.
The P
configuration command only tells sendmail
the value
to assign to a given name
. It
has no other effect. The values are used only when a mail
message is processed that has a Precedence:
header
line in it. The inclusion of Precedence:
header lines
is left to MUAs.
To illustrate, imagine that a user on your machine is managing
a mailing list. The software that is used to create each message
for the list arranges to include a Precedence:
header
that looks like this:
Precedence: list
The mailing-list message is given to sendmail on the local
machine. The local sendmail sees the Precedence:
header
in the message and extracts the field of that header, the list
.
It then compares list
to each of the name
parts of its P
configuration lines. It finds a match
with the line:
Plist=-30
Because it finds a match, it uses the value
from this
configuration command as the initial precedence of the mail message.
If there is no match (or if the original message lacks
a Precedence:
header), the initial precedence of the
mail message defaults to zero.
Now add P
configuration commands to
the client.cf file. Traditionally, they are placed after the header
commands:
H?D?Date: $a # Add if F=D H?M?Message-Id: <$t.$i@$j> # Add if F=M# Precedence
newPspecial-delivery=100
newPfirst-class=0
newPlist=-30
newPbulk=-60
newPjunk=-100
new