# Postfix Anatomy - Delivering Mail

Up one level | Receiving Mail | Delivering Mail | Behind the Scenes | Command-line Utilities

Once a message has reached the incoming queue the next step is to deliver it. The figure shows the main components of the Postfix mail delivery apparatus. For an explanation of the symbols, click on the icon in the upper left-hand corner of this page.

- The queue manager is the heart of the Postfix mail system. It contacts the local, smtp, lmtp, or pipe delivery agents, and sends a delivery request with queue file pathname information, the message sender address, the host to deliver to if the destination is remote, and one or more message recipient addresses.

  The queue manager maintains a separate deferred queue for mail that cannot be delivered, so that a large mail backlog will not slow down normal queue accesses.

  The queue manager maintains a small active queue with just the few messages that it has opened for delivery. The active queue acts as a limited window on the potentially much larger incoming or deferred queues. The small active queue prevents the queue manager from running out of memory under heavy load.

  Optionally, the queue manager bounces mail for recipients that are listed in the relocated table. This table contains contact information for users or even entire domains that no longer exist.

- On request by the queue manager, the trivial-rewrite daemon resolves destinations. By default, it only distinguishes between local and remote destinations. Additional routing information can be specified with the optional transport table.

- On request by the queue manager, the bounce or defer daemon generates non-delivery reports when mail cannot be delivered, either due to an unrecoverable error or because the destination is unreachable for an extended period of time.

- The local delivery agent understands UNIX-style mailboxes, sendmail-style system-wide alias databases, and sendmail-style per-user .forward files. Multiple local delivery agents can be run in parallel, but parallel delivery to the same user is usually limited.

  Together with the sendmail mail posting agent, the local delivery agent implements the familiar Sendmail user interface.

  The local delivery agent has hooks for alternative forms of local delivery: you can configure it to deliver to mailbox files in user home directories, and you can even configure it to delegate mailbox delivery to an external command such as the popular procmail program.

- The virtual delivery agent is a very much stripped down version of the local delivery agent that delivers to mailboxes only. This is the most secure Postfix delivery agent, because it does not aliases expansions and no .forward file expansions.

  This delivery agent can deliver mail for multiple domains, which makes it especially suitable for hosting lots of small domains on a single machine.

- The SMTP client looks up a list of mail exchangers for the destination host, sorts the list by preference, and tries each address in turn until it finds a server that responds. On a busy Postfix system you will see several SMTP client processes running in parallel.

- The LMTP client speaks a protocol similar to SMTP. The client can connect to local or remote mailbox servers such as Cyrus. All the queue management is done by Postfix. The advantage of this setup is that one Postfix machine can feed multiple mailbox servers over LMTP. The opposite is true as well: one mailbox server can be fed over LMTP by multiple Postfix machines.

- The pipe mailer is the outbound interface to other mail transports (the sendmail program is the inbound interface). The Postfix mail system comes with examples for delivery via the UUCP protocol. At the time of writing, this venerable protocol is still widely used. By default, Postfix understands bang path style addresses.

Up one level | Receiving Mail | Delivering Mail | Behind the Scenes | Command-line Utilities