Messages come into Postfix in one of four ways:
A message can be accepted into Postfix locally (sent from a user on the same machine).
A message can be accepted into Postfix over the network.
A message that was already accepted into Postfix through one of the other methods is resubmitted for forwarding to another address.
Postfix generates messages itself when it has to send notifications of undeliverable or deferred delivery attempts.
There is always the possibility that a message is rejected before it enters the Postfix system, or that some messages are deferred for later delivery.
The various Postfix components work together by writing messages to and reading messages from the queue. The queue manager has the responsibility of managing messages in the queue and alerting the correct component when it has a job to do.
Figure 3-2
illustrates the flow when a local email message enters the Postfix
system. Local messages are deposited into the maildrop directory of the Postfix queue by the postdrop command, usually through the sendmail compatibility program. The pickup daemon reads the message from the queue and feeds it to
the cleanup daemon. Some messages
arrive without all of the required information for a valid email
message. So in addition to sanity checks on the message, the cleanup daemon, in conjunction with the
trivial-rewrite daemon inserts missing message headers, converts addresses to the
user@domain.tld format expected by other Postfix programs, and
possibly translates addresses based on the canonical or virtual lookup
tables (see Chapter 4 for more
information on lookup tables).
The cleanup daemon processes
all inbound mail and notifies the queue manager after it has placed the cleaned-up message
into the incoming queue. The queue manager then invokes the
appropriate delivery agent to send the message to its next hop or
ultimate destination.
Figure 3-3 illustrates the flow when a network email message enters the Postfix system.
Messages received over the network are accepted by the Postfix
smtpd daemon. This daemon performs sanity checking and can be
configured to allow clients to relay mail on the system or deny them
from doing so. The smtpd daemon
passes the message to the cleanup
daemon, which performs its own checks then deposits the
message into the incoming queue. The queue manager then invokes the appropriate delivery
agent to send the message to its next hop or ultimate
destination.
When a user message is deferred or can’t be delivered, Postfix
uses the defer or bounce daemons to
create a new error message. The error message is handed off to the
cleanup daemon. It performs its normal checks before depositing
the error message into the incoming queue, where it is picked up by
the queue manager.
Sometimes, after processing an email message, Postfix determines that the destination address actually points to another address on another system. It could, at that point, simply hand off the message to the SMTP client for immediate delivery, but to make sure that every recipient is processed and logged correctly, Postfix resubmits it as a new message where it is handled like any other locally submitted message.