Let’s follow a typical message through the Postfix system.
Figure 3-4, Figure 3-5, and Figure 3-6 illustrate the process
as the message goes from the originating system to a destination MTA,
which, in turn, forwards it to the final MTA, where it is held until the
user is ready to read it. In Figure
3-4, Helene (helene@oreilly.com) wants to
send a message to Frank (frank@postfix.org). Helene
has an account on a system that runs Postfix. Her email client lets her
compose the message, and then it calls the Postfix sendmail command to send it. The Postfix
sendmail command receives the message from Helene’s email software
and deposits it into the maildrop
directory. The pickup
daemon then retrieves the message, performs its sanity
checks, and feeds the message to the cleanup daemon, which performs the final processing on the new
message. If Helene’s email client did not include a From: address, or did not use a
fully-qualified hostname in the address, cleanup makes the necessary fixes to the
message.
Once finished, cleanup places
the message into the incoming queue
and notifies the queue manager that a new message is ready to be
delivered. If the queue manager is ready to process new messages, it
moves the message into the active queue. Because this message is
destined for a user on an outside system, the queue manager has to alert
the smtp agent to handle the delivery of the message.
The smtp agent uses DNS (see
Chapter 6) to get a list of email
systems that can accept mail for the domain http://postfix.org. The smtp delivery agent selects the most preferred
MX host from the list and contacts it to deliver Helene’s
message.
Figure 3-5 shows
Frank’s email server at http://postfix.org also running Postfix, although the
system could be using any other standards-compliant MTA. The Postfix
smtpd on Frank’s server takes the
message from Helene’s smtp delivery
agent. After the smtpd daemon verifies that it should, in fact, accept this
message, it passes the message through to the cleanup daemon, which performs its checks
before depositing the message into the incoming queue.
The queue manager moves the message to the active queue, performs its processing, and determines that
it should call on the local
agent to make the final delivery of the message. The
local delivery agent finds that frank is an alias
and resubmits the message through the cleanup daemon for delivery to the new
address.
Both cleanup and the queue
manager call upon the trivial-rewrite
daemon when processing messages. trivial-rewrite helps with converting email
addresses to a standard format and determining the transport type and
next hop for delivery.
When a new message has to be delivered to another network, the
queue manager calls on smtp, which
checks the DNS for mail servers that can accept mail for the domain
http://onlamp.com. In Figure 3-6, the MTA at the
http://onlamp.com system
(once again by a happy coincidence, it’s a Postfix system) eventually
hands the message to the local
delivery agent, which deposits it into the message store
on that system. At this point Postfix has finished its job. Frank can
now read the message using his own email client, which might pull it
directly from the local message store or might use another protocol,
such as POP or IMAP, to get the message for him to read.
There are several variations that might have occurred in our
simple example. Perhaps the message could not be delivered at any step
for some temporary reason, in which case the delivery agent alerts the
queue manager, which places the message into the deferred queue and
attempts another delivery at a later time. Another possibility is that
doel is not an actual account on the system but an
account in an IMAP email system. In this case, the queue manager might
deliver the message through the lmtp
agent or via a specialized command configured through the
pipe delivery agent.
There are many variations and potential complications for Postfix to deal with. Fortunately, the architecture is robust enough to deal with nearly all situations, and flexible enough to easily accommodate changes in the future.