Postfix/flow

About
There are multiple stages inside Postfix, and each stage can be affected by configuration parameters. I have not yet found a clear documentation of the data flow, but it seems to go like this (only much more complicated) under normal circumstances:


 * SMTP &rarr; Postfix delivery queue &rarr; user alias mappings &rarr; local delivery (MDA, e.g. Dovecot)

However, when using virtual (non-system) users, internally-generated emails (e.g. mail from cron or PHP's mail function) seem to bypass the alias mappings, which the MDA then rejects if they are addressed to an alias instead of a user.

A table from the official documentation is more detailed (the "-&lt;" between the last two boxes in the original document is apparently intended to indicate rightward movement with a fan-out, i.e. the message may go through any of the 3 sub-boxes on the right; it has been replaced with "-&gt;" here).  smtpd(8)   &gt;-   cleanup(8)   -&gt;   incoming   -&gt;   active   -&gt;  <td rowspan="3" align="center" bgcolor="#f0f0ff"> qmgr(8) <td rowspan="3" valign="middle" align="center">  -&gt; </tt> <td valign="middle" align="center" bgcolor="#f0f0ff"> smtp(8) <td valign="middle" align="center" bgcolor="#f0f0ff"> qmqpd(8) <td valign="middle" align="center" bgcolor="#f0f0ff"> lmtp(8) <td valign="middle" align="center" bgcolor="#f0f0ff"> pickup(8) <td valign="middle" align="center" bgcolor="#f0f0ff"> local ^  | </tt> bounces forwarding notices <td align="center" bgcolor="#f0f0ff"> deferred There are two more diagrams here; the first shows the input stage in a bit more detail, and the second shows the delivery stage. There are two more diagrams here, showing where filtering takes place.