.SH
Deliver
.PP
The \fBdeliver\fR process changed little until late 1984,
when a dead-host caching facility and advanced retry mechanisms
were added to \fBdeliver\fR.
Until then, the major changes to \fBdeliver\fR were
bug fixes and changes to enhance error recovery.
Most notably, the mechanism to return mail was made much more persistent.
In MMDFI, if a message could not be returned to the sender, it
was ``dropped on the floor''.  This is not acceptable.
The new mechanism first tries to return to the sender; if that fails,
an attempt is made to send the message to the local ``Postmaster''
address.  If this too fails, then \fBdeliver\fR tries to write the message
into a ``dead letter'' file
(usually /usr/mmdf/lock/home/DeadLetters).
The last resort is to scream loudly into the log files.
.PP
The recent changes to \fBdeliver\fR are
designed to reduce \fBdeliver\fR's load
on a system that handles a large amount of mail.
The first change is to move the dead-host caching function out
of the channels (currently only SMTP) and into \fBdeliver\fR.  This has
two advantages.
First, \fBdeliver\fR no longer has to hand every address to
the channel to find out that the host is dead.  This was expensive, since
communications between \fBdeliver\fR and the channel
are interactive using pipes
and thus involved a great deal of context-switching and pipe I/O.
Second, the dead-host caching is now a generally available facility that
can be used by any channel without duplication of code.
.PP
The second change is to add a mechanism for storing the retry history
for each dead host on each channel including retry count and last retry
time.
From this information it is possible to implement intelligent
retry strategies using exponential backoff and maximal retry times.
This greatly reduces the overhead caused by recalcitrant hosts
that are unavailable over a long period of time.
The retry history change is conditionally compiled
into deliver since it can,
by design, use quite a bit of memory if there are a lot of dead
hosts or pending messages (or both!).
Machines with a relatively limited address space may not
be able to use this feature.
