Processing a Single Message
A single queued message has a single sender but can have many recipients. When processing a queued message, sendmail attempts to deliver it to all recipients before processing the next queued message.
The first step in processing a queued message is to
lock it so that concurrent runs of
sendmail do not attempt to
process it simultaneously (Current-style file locking on page
398). Then the qf
file is opened and read. The sender and all the
recipients are gathered from the corresponding
S
and R
lines.
For each recipient, delivery is attempted. If delivery is successful, that recipient’s address is removed from the sendmail program’s internal list of recipient addresses. If delivery fails, that address is either left in the list or bounced, depending on the nature of the error.
After all recipients have been either delivered,
bounced, or left in the list,
sendmail reexamines that
list. If there are no recipients left in it, the
message is dequeued (all the
files in the queue directory that compose it are
removed). If any recipients are left, each recipient
results in an M
line that is assigned the last error message for
that recipient, and the qf
file is rewritten with the list of
the remaining recipients and a dot. Finally, the
qf
file is
closed, thus freeing its lock.
Under V8 sendmail, the CheckpointInterval
option (CheckpointInterval on page
983) causes checkpointing of this process. When this
option has a positive value, the qf
file is rewritten after that ...
Get sendmail, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.