1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 4<html> 5 6<head> 7 8<title>Postfix Architecture Overview </title> 9 10<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 11 12</head> 13 14<body> 15 16<h1> <img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix 17Architecture Overview </h1> 18 19<hr> 20 21<h2> Introduction </h2> 22 23<p> This document presents an overview of the Postfix architecture, 24and provides pointers to descriptions of every Postfix command 25or server program. The text gives the general context in which 26each command or server program is used, and provides pointers to 27documents with specific usage examples and background information. 28</p> 29 30<p> Topics covered by this document: </p> 31 32<ul> 33 34<li> <a href="#receiving"> How Postfix receives mail </a> 35 36<li> <a href="#delivering"> How Postfix delivers mail </a> 37 38<li> <a href="#behind"> Postfix behind the scenes </a> 39 40<li> <a href="#commands"> Postfix support commands </a> 41 42</ul> 43 44<h2><a name="receiving"> How Postfix receives mail </a> </h2> 45 46<p> When a message enters the Postfix mail system, the first stop 47on the inside is the <a href="QSHAPE_README.html#incoming_queue">incoming queue</a>. The figure below shows the 48main processes that are involved with new mail. Names followed by 49a number are Postfix commands or server programs, while unnumbered 50names inside shaded areas represent Postfix queues. </p> 51 52<blockquote> 53 54<table> 55 56<tr> 57 58<td colspan="4"> </td> 59 60<td bgcolor="#f0f0ff" align="center"> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> </td> 61 62</tr> 63 64<tr> 65 66<td> Network </td> <td> <tt> -> </tt> </td> 67 68<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="smtpd.8.html">smtpd(8)</a> 69</td> 70 71<td> </td> 72 73<td rowspan="2" align="center"> <table> <tr> <td align="center"> 74^<br> <tt> | </tt> </td> <td align="center"> <tt> |<br> v </tt> 75</td> </tr> </table> </td> 76 77</tr> 78 79<tr> 80 81<td colspan="3"> </td> <td> <tt> \ </tt> </td> 82 83</tr> 84 85<tr> 86 87<td> Network </td> <td> <tt> -> </tt> </td> 88 89<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="qmqpd.8.html">qmqpd(8)</a> 90</td> 91 92<td> <tt> -> </tt> </td> 93 94<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="cleanup.8.html">cleanup(8)</a> 95</td> 96 97<td> <tt> -> </tt> </td> 98 99<td bgcolor="#f0f0ff" align="center" valign="middle"> <a 100href="QSHAPE_README.html#incoming_queue"> incoming </a> </td> 101 102</tr> 103 104<tr> 105 106<td colspan="3"> </td> <td> <tt> / </tt> </td> 107 108</tr> 109 110<tr> 111 112<td colspan="2"> </td> 113 114<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="pickup.8.html">pickup(8)</a> 115</td> 116 117<td> <tt> <- </tt> </td> 118 119<td bgcolor="#f0f0ff" align="center" valign="middle"> <a 120href="QSHAPE_README.html#maildrop_queue"> maildrop </a> </td> 121 122</tr> 123 124<tr> 125 126<td colspan="4" align="center"> </td> 127 128<td align="center"> ^<br> <tt> | </tt> </td> 129 130</tr> 131 132<tr> 133 134<td> Local </td> <td> <tt> -> </tt> </td> 135 136<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="sendmail.1.html">sendmail(1)</a> 137</td> 138 139<td> <tt> -> </tt> </td> 140 141<td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="postdrop.1.html">postdrop(1)</a> 142</td> 143 144</tr> 145 146</table> 147 148</blockquote> 149 150<ul> 151 152<li> <p> Network mail enters Postfix via the <a href="smtpd.8.html">smtpd(8)</a> or <a href="qmqpd.8.html">qmqpd(8)</a> 153servers. These servers remove the SMTP or QMQP protocol encapsulation, 154enforce some sanity checks to protect Postfix, and give the sender, 155recipients and message content to the <a href="cleanup.8.html">cleanup(8)</a> server. The 156<a href="smtpd.8.html">smtpd(8)</a> server can be configured to block unwanted mail, as 157described in the <a href="SMTPD_ACCESS_README.html">SMTPD_ACCESS_README</a> document. </p> 158 159<li> <p> Local submissions are received with the Postfix <a href="sendmail.1.html">sendmail(1)</a> 160compatibility command, and are queued in the <a href="QSHAPE_README.html#maildrop_queue">maildrop queue</a> by 161the privileged <a href="postdrop.1.html">postdrop(1)</a> command. This arrangement even works 162while the Postfix mail system is not running. The local <a href="pickup.8.html">pickup(8)</a> 163server picks up local submissions, enforces some sanity checks to 164protect Postfix, and gives the sender, recipients and message 165content to the <a href="cleanup.8.html">cleanup(8)</a> server. </p> 166 167<li> <p> Mail from internal sources is given directly to the 168<a href="cleanup.8.html">cleanup(8)</a> server. These sources are not shown in the figure, and 169include: mail that is forwarded by the <a href="local.8.html">local(8)</a> delivery agent (see 170next section), messages that are returned to the sender by the 171<a href="bounce.8.html">bounce(8)</a> server (see second-next section), and postmaster 172notifications about problems with Postfix. </p> 173 174<li> <p> The <a href="cleanup.8.html">cleanup(8)</a> server implements the final processing 175stage before mail is queued. It adds missing From: and other message 176headers, and transforms addresses as described in the 177<a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a> 178document. Optionally, the <a href="cleanup.8.html">cleanup(8)</a> server can be configured to 179do light-weight content inspection with regular expressions as 180described in the <a href="BUILTIN_FILTER_README.html">BUILTIN_FILTER_README</a> document. The <a href="cleanup.8.html">cleanup(8)</a> 181server places the result as a single file into the <a href="QSHAPE_README.html#incoming_queue">incoming queue</a>, 182and notifies the queue manager (see next section) of the arrival 183of new mail. </p> 184 185<li> <p> The <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> server rewrites addresses to the 186standard "user@fully.qualified.domain" form, as described in the 187<a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a> document. Postfix currently does not 188implement a rewriting language, but a lot can be done via table 189lookups and, if need be, regular expressions. </p> 190 191</ul> 192 193<h2> <a name="delivering"> How Postfix delivers mail </a> </h2> 194 195<p> Once a message has reached the <a href="QSHAPE_README.html#incoming_queue">incoming queue</a> the next step is 196to deliver it. The figure shows the main components of the Postfix 197mail delivery apparatus. Names followed by a number are Postfix 198commands or server programs, while unnumbered names inside shaded 199areas represent Postfix queues. </p> 200 201<blockquote> 202 203<table> 204 205<tr> 206 207<td rowspan="2" colspan="4"> </td> 208 209<td rowspan="2" bgcolor="#f0f0ff" align="center"> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> 210</td> 211 212<td> </td> 213 214<td bgcolor="#f0f0ff" align="center"> <a href="smtp.8.html">smtp(8)</a> </td> 215 216<td> <tt> -> </tt> </td> <td> Network </td> 217 218</tr> 219 220<tr> 221 222<td align="right"> <tt> / </tt> </td> 223 224</tr> 225 226<tr> 227 228<td rowspan="2" colspan="4"> </td> 229 230<td rowspan="2" align="center"> <table> <tr> <td align="center"> 231^<br> <tt> | </tt> </td> <td align="center"> <tt> |<br> v </tt> 232</td> </tr> </table> </td> 233 234<td align="right"> <tt> - </tt> </td> 235 236<td bgcolor="#f0f0ff" align="center"> <a href="lmtp.8.html">lmtp(8)</a> </td> 237 238<td> <tt> -> </tt> </td> <td> Network </td> 239 240</tr> 241 242<tr> 243 244<td align="left"> <tt> / </tt> </td> 245 246</tr> 247 248<tr> 249 250<td bgcolor="#f0f0ff" align="center"> <a 251href="QSHAPE_README.html#incoming_queue"> incoming </a> </td> 252 253<td> <tt> -> </tt> </td> 254 255<td bgcolor="#f0f0ff" align="center"> <a 256href="QSHAPE_README.html#active_queue"> active </a> </td> 257 258<td> <tt> -> </tt> </td> 259 260<td bgcolor="#f0f0ff" align="center"> <a href="qmgr.8.html">qmgr(8)</a> </td> 261 262<td align="right"> <tt> --- </tt> </td> 263 264<td bgcolor="#f0f0ff" align="center"> <a href="local.8.html">local(8)</a> </td> 265 266<td> <tt> -> </tt> </td> <td> File, command </td> 267 268</tr> 269 270<tr> 271 272<td rowspan="2" colspan="2"> </td> 273 274<td rowspan="2" align="center"> <table> <tr> <td align="center"> 275^<br> <tt> | </tt> </td> <td align="center"> <tt> |<br> v </tt> 276</td> </tr> </table> </td> 277 278<td rowspan="2" colspan="2"> </td> 279 280<td align="left"> <tt> \ </tt> </td> 281 282</tr> 283 284<tr> 285 286<td align="right"> <tt> - </tt> </td> 287 288<td bgcolor="#f0f0ff" align="center"> <a href="virtual.8.html">virtual(8)</a> </td> 289 290<td> <tt> -> </tt> </td> <td> File </td> 291 292</tr> 293 294<tr> 295 296<td colspan="2"> </td> 297 298<td bgcolor="#f0f0ff" align="center"> <a 299href="QSHAPE_README.html#deferred_queue"> deferred </a> </td> 300 301<td colspan="2"> </td> 302 303<td align="right"> <tt> \ </tt> </td> 304 305</tr> 306 307<tr> 308 309<td colspan="6"> 310 311<td bgcolor="#f0f0ff" align="center"> <a href="pipe.8.html">pipe(8)</a> </td> 312 313<td> <tt> -> </tt> </td> <td> Command </td> 314 315</tr> 316 317</table> 318 319</blockquote> 320 321<ul> 322 323<li> <p> The queue manager (the <a href="qmgr.8.html">qmgr(8)</a> server process in the 324figure) is the heart of Postfix mail delivery. It contacts the 325<a href="smtp.8.html">smtp(8)</a>, <a href="lmtp.8.html">lmtp(8)</a>, <a href="local.8.html">local(8)</a>, <a href="virtual.8.html">virtual(8)</a>, <a href="pipe.8.html">pipe(8)</a>, <a href="discard.8.html">discard(8)</a> or 326<a href="error.8.html">error(8)</a> delivery agents, and sends a delivery request for one 327or more recipient addresses. The <a href="discard.8.html">discard(8)</a> and <a href="error.8.html">error(8)</a> delivery 328agents are special: they discard or bounce all mail, and are not 329shown in the figure above. </p> 330 331<p> The queue manager maintains a small <a href="QSHAPE_README.html#active_queue">active queue</a> with the 332messages that it has opened for delivery. The <a href="QSHAPE_README.html#active_queue">active queue</a> acts as 333a limited window on potentially large <a href="QSHAPE_README.html#incoming_queue">incoming</a> or <a href="QSHAPE_README.html#deferred_queue">deferred queues</a>. 334The limited <a href="QSHAPE_README.html#active_queue">active queue</a> prevents the queue manager from running 335out of memory under heavy load. </p> 336 337<p> The queue manager maintains a separate <a href="QSHAPE_README.html#deferred_queue">deferred queue</a> for mail 338that cannot be delivered, so that a large mail backlog will not 339slow down normal queue accesses. The queue manager's strategy for 340delayed mail delivery attempts is described in the <a href="QSHAPE_README.html">QSHAPE_README</a> 341and <a href="TUNING_README.html">TUNING_README</a> documents. </p> 342 343<li> <p> The <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> server resolves each recipient 344address according to its local or remote address class, as defined 345in the <a href="ADDRESS_CLASS_README.html">ADDRESS_CLASS_README</a> document. Additional routing information 346can be specified with the optional <a href="transport.5.html">transport(5)</a> table. The 347<a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> server optionally queries the <a href="relocated.5.html">relocated(5)</a> table 348for recipients whose address has changed; mail for such recipients is 349returned to the sender with an explanation. </p> 350 351<li> <p> The <a href="smtp.8.html">smtp(8)</a> client looks up a list of mail exchangers for 352the destination host, sorts the list by preference, and tries each 353server in turn until it finds a server that responds. It then 354encapsulates the sender, recipient and message content as required 355by the SMTP protocol; this includes conversion of 8-bit MIME to 3567-bit encoding. </p> 357 358<li> <p> The <a href="lmtp.8.html">lmtp(8)</a> client speaks a protocol similar to SMTP that 359is optimized for delivery to mailbox servers such as Cyrus. The 360advantage of this setup is that one Postfix machine can feed multiple 361mailbox servers over LMTP. The opposite is true as well: one 362mailbox server can be fed over LMTP by multiple Postfix machines. 363</p> 364 365<li> <p> The <a href="local.8.html">local(8)</a> delivery agent understands UNIX-style mailboxes, 366qmail-compatible maildir files, Sendmail-style system-wide <a href="aliases.5.html">aliases(5)</a> 367databases, and Sendmail-style per-user .forward files. Multiple 368local delivery agents can be run in parallel, but parallel delivery 369to the same user is usually limited. </p> 370 371<p> The <a href="local.8.html">local(8)</a> delivery agent has hooks for alternative forms of 372local delivery: you can configure it to deliver to mailbox files 373in user home directories, you can configure it to delegate mailbox 374delivery to an external command such as procmail, or you can delegate 375delivery to a different Postfix delivery agent. </p> 376 377<li> <p> The <a href="virtual.8.html">virtual(8)</a> delivery agent is a bare-bones delivery 378agent that delivers to UNIX-style mailbox or qmail-style maildir 379files only. This delivery agent can deliver mail for multiple 380domains, which makes it especially suitable for hosting lots of 381small domains on a single machine. This is described in the 382<a href="VIRTUAL_README.html">VIRTUAL_README</a> document. </p> 383 384<li> <p> The <a href="pipe.8.html">pipe(8)</a> mailer is the outbound interface to other mail 385processing systems (the Postfix <a href="sendmail.1.html">sendmail(1)</a> command being the 386inbound interface). The interface is UNIX compatible: it provides 387information on the command line and on the standard input stream, 388and expects a process exit status code as defined in <sysexits.h>. 389Examples of delivery via the <a href="pipe.8.html">pipe(8)</a> mailer are in the <a href="MAILDROP_README.html">MAILDROP_README</a> 390and <a href="UUCP_README.html">UUCP_README</a> documents. 391 392</ul> 393 394<h2> <a name="behind"> Postfix behind the scenes </a> </h2> 395 396<p> The previous sections gave an overview of how Postfix server 397processes send and receive mail. These server processes rely on 398other server processes that do things behind the scenes. The text 399below attempts to visualize each service in its own context. As 400before, names followed by a number are Postfix commands or server 401programs, while unnumbered names inside shaded areas represent 402Postfix queues. </p> 403 404<ul> 405 406<li> <p> The resident <a href="master.8.html">master(8)</a> server is the supervisor that keeps 407an eye on the well-being of the Postfix mail system. It is typically 408started at system boot time with the "postfix start" command, and 409keeps running until the system goes down. The <a href="master.8.html">master(8)</a> server is 410responsible for starting Postfix server processes to receive and 411deliver mail, and for restarting servers that terminate prematurely 412because of some problem. The <a href="master.8.html">master(8)</a> server is also responsible 413for enforcing the server process count limits as specified in the 414<a href="master.5.html"><b>master.cf</b></a> configuration file. The picture below gives the 415program hierarchy when Postfix is started up. Only some of the mail 416handling daemon processes are shown. </p> 417 418<table> 419 420<tr> <td colspan="2"> </td> <td align="center" bgcolor="#f0f0ff"> 421<a href="postfix.1.html">postfix(1)</a> </td> </tr> 422 423<tr> <td colspan="2"> </td> <td align="center"> |<br> |</td> </tr> 424 425<tr> <td colspan="2"> </td> <td align="center" bgcolor="#f0f0ff"> 426postfix-script(1) </td> </tr> 427 428<tr> <td> </td> <td> <table> <tr> <td> </td> <td> / </td> </tr> 429<tr> <td> / </td> <td> </td> </tr> </table> </td> <td align="center"> 430|<br> |</td> <td> <table> <tr> <td> \ </td> <td> </td> </tr> <tr> 431<td> </td> <td> \ </td> </tr> </table> </td> </tr> 432 433<tr> <td align="center" bgcolor="#f0f0ff"> <a href="postsuper.1.html">postsuper(1)</a> </td> <td> 434</td> <td align="center" bgcolor="#f0f0ff"> <a href="master.8.html">master(8)</a> </td> <td> 435</td> <td align="center" bgcolor="#f0f0ff"> <a href="postlog.1.html">postlog(1)</a> </td> </tr> 436 437<tr> <td> </td> <td> <table> <tr> <td> </td> <td> / </td> </tr> 438<tr> <td> / </td> <td> </td> </tr> </table> </td> <td align="center"> 439|<br> |</td> <td> <table> <tr> <td> \ </td> <td> </td> </tr> <tr> 440<td> </td> <td> \ </td> </tr> </table> </td> </tr> 441 442<tr> <td align="center" bgcolor="#f0f0ff"> <a href="smtpd.8.html">smtpd(8)</a> </td> <td> 443</td> <td align="center" bgcolor="#f0f0ff"> <a href="qmgr.8.html">qmgr(8)</a> </td> <td> 444</td> <td align="center" bgcolor="#f0f0ff"> <a href="local.8.html">local(8)</a> </td> </tr> 445 446</table> 447 448<li> <p> The <a href="anvil.8.html">anvil(8)</a> server implements client connection and 449request rate 450limiting for all <a href="smtpd.8.html">smtpd(8)</a> servers. The <a href="TUNING_README.html">TUNING_README</a> document 451provides guidance for dealing with mis-behaving SMTP clients. The 452<a href="anvil.8.html">anvil(8)</a> service is available in Postfix version 2.2 and later. 453</p> 454 455<table> 456 457<tr> <td> Network </td> <td> <tt> -> </tt> </td> <td align="center" 458bgcolor="#f0f0ff"> <br> <a href="smtpd.8.html">smtpd(8)</a><br><br> </td> <td> <tt> <-> 459</tt> </td> <td align="center" bgcolor="#f0f0ff"> <br> <a href="anvil.8.html">anvil(8)</a><br><br> 460</td> </tr> 461 462</table> 463 464<li> <p> The <a href="bounce.8.html">bounce(8)</a>, <a href="defer.8.html">defer(8)</a> and <a href="trace.8.html">trace(8)</a> services each maintain 465their own queue directory trees with per-message logfiles. Postfix 466uses this information when sending "failed", "delayed" or "success" 467delivery status notifications to the sender. </p> 468 469<p> The <a href="trace.8.html">trace(8)</a> service also implements support for the Postfix 470"sendmail 471-bv" and "sendmail -v" commands which produce reports about how 472Postfix delivers mail, and is available with Postfix version 2.1 473and later. See <a href="DEBUG_README.html#trace_mail"> DEBUG_README 474</a> for examples. </p> 475 476<table> 477 478<tr> <td align="center" bgcolor="#f0f0ff"> <a href="cleanup.8.html">cleanup(8)</a> </td> <td 479valign="middle"> <tt> -> </tt> </td> <td align="center" 480bgcolor="#f0f0ff"> <a href="qmgr.8.html">qmgr(8)</a><br> Postfix<br> queue </td> <td 481valign="middle"> <tt> -> </tt> </td> <td align="center" 482bgcolor="#f0f0ff"> Delivery<br> agents</td> </tr> 483 484<tr> <td align="center"> ^<br> <tt> | </tt> </td> <td> </td> <td 485align="center"> <tt> |<br> v </tt> </td> <td> </td> <td align="center"> 486<tt> |<br> v </tt> </td> </tr> 487 488<tr> <td align="center"> (Non-)<br> delivery<br> notice </td> <td 489valign="middle"> <tt> <- </tt> </td> <td align="center" 490bgcolor="#f0f0ff"> <a href="bounce.8.html">bounce(8)</a><br> <a href="defer.8.html">defer(8)</a><br> <a href="trace.8.html">trace(8)</a> </td> <td 491valign="middle"> <tt> <- </tt> </td> <td align="center"> Queue 492id,<br> recipient,<br> status</td> </tr> 493 494<tr> <td colspan="2"> </td> <td align="center"> <table> <tr> <td 495align="center"> ^<br> <tt> | </tt> </td> <td align="center"> <tt> 496|<br> v </tt> </td> </tr> </table> </td> </tr> 497 498<tr> <td colspan="2"> </td> <td align="center" bgcolor="#f0f0ff"> 499Per- <br> message<br> logfiles </td> </tr> 500 501</table> 502 503<li> <p> The <a href="flush.8.html">flush(8)</a> servers maintain per-destination logs and 504implement both ETRN and "sendmail -qRdestination", as described 505in the <a href="ETRN_README.html">ETRN_README</a> document. This moves selected queue files from 506the <a href="QSHAPE_README.html#deferred_queue">deferred queue</a> back to the <a href="QSHAPE_README.html#incoming_queue">incoming queue</a> and requests their 507delivery. The <a href="flush.8.html">flush(8)</a> service is available with Postfix version 5081.0 and later. </p> 509 510<table> 511 512<tr> <td colspan="4"> </td> <td align="center" bgcolor="#f0f0ff"> 513<a href="QSHAPE_README.html#incoming_queue"> incoming </a><br>^ 514<br><a href="QSHAPE_README.html#deferred_queue"> deferred </a> 515</td> </tr> 516 517<tr> <td colspan="4"> </td> <td align="center"> ^<br> |</td> </tr> 518 519<tr> <td align="center" bgcolor="#f0f0ff"> <a href="smtpd.8.html">smtpd(8)</a><br> <a href="sendmail.1.html">sendmail(1)</a><br> 520<a href="postqueue.1.html">postqueue(1)</a> </td> <td> <tt> - </tt> </td> <td align="center"> 521Destination<br> to flush</td> <td> <tt> -> </tt> </td> <td 522align="center" bgcolor="#f0f0ff"> <a href="flush.8.html">flush(8)</a> </td> <td> <tt> <- 523</tt> </td> <td align="center"> Deferred<br> destination,<br> queue 524id </td> <td> <tt> - </tt> </td> <td align="center" bgcolor="#f0f0ff"> 525Delivery<br> agents,<br> <a href="qmgr.8.html">qmgr(8)</a> </td> </tr> 526 527<tr> <td colspan="4"> </td> <td align="center"> <table> <tr> <td 528align="center"> ^<br> <tt> | </tt> </td> <td align="center"> <tt> 529|<br> v </tt> </td> </tr> </table> </td> </tr> 530 531<tr> <td colspan="4"> </td> <td align="center"> Per-dest-<br> 532ination<br> logs </td> </tr> 533 534</table> 535 536<li> <p> The <a href="proxymap.8.html">proxymap(8)</a> servers provide read-only and read-write 537table lookup 538service to Postfix processes. This overcomes chroot restrictions, 539reduces the number of open lookup tables by sharing one open 540table among multiple processes, and implements single-updater 541tables. </p> 542 543<li> <p> The <a href="scache.8.html">scache(8)</a> server maintains the connection cache for 544the Postfix <a href="smtp.8.html">smtp(8)</a> client. When connection caching is enabled for 545selected destinations, the <a href="smtp.8.html">smtp(8)</a> client does not disconnect 546immediately after a mail transaction, but gives the connection to 547the connection cache server which keeps the connection open for a 548limited amount of time. The <a href="smtp.8.html">smtp(8)</a> client continues with some 549other mail delivery request. Meanwhile, any <a href="smtp.8.html">smtp(8)</a> process can 550ask the <a href="scache.8.html">scache(8)</a> server for that cached connection and reuse it 551for mail delivery. As a safety measure, Postfix limits the number 552of times that a connection may be reused. </p> 553 554<p> When delivering mail to a destination with multiple mail servers, 555connection caching can help to skip over a non-responding server, 556and thus dramatically speed up delivery. SMTP connection caching 557is available in Postfix version 2.2 and later. More information 558about this feature is in the <a href="CONNECTION_CACHE_README.html">CONNECTION_CACHE_README</a> document. </p> 559 560<table> 561 562<tr> <td> </td> <td> <tt> /-- </tt> </td> <td align="center" 563colspan="3" bgcolor="#f0f0ff"> <a href="smtp.8.html">smtp(8)</a> </td> <td colspan="2"> <tt> 564--> </tt> </td> <td> Internet </td> </tr> 565 566<tr> <td align="center" bgcolor="#f0f0ff"> <a href="qmgr.8.html">qmgr(8)</a> </td> <td> </td> 567<td align="center" rowspan="3"><tt>|<br>|<br>|<br>|<br>v</tt></td> 568</tr> 569 570<tr> <td> </td> <td> <tt> \-- </tt> </td> <td align="center" 571colspan="4" bgcolor="#f0f0ff"> <a href="smtp.8.html">smtp(8)</a> </td> <td align="left"> 572 </td> </tr> 573 574<tr> <td colspan="2"> </td> <td> </td> <td 575align="center"><tt>^<br>|</tt></td> </tr> 576 577<tr> <td colspan="2"> </td> <td align="center" colspan="3" 578bgcolor="#f0f0ff"> <a href="scache.8.html">scache(8)</a> </td> </tr> 579 580</table> 581 582<p> A Postfix <a href="smtp.8.html">smtp(8)</a> client can reuse a TLS-encrypted connection 583(with "<a href="postconf.5.html#smtp_tls_connection_reuse">smtp_tls_connection_reuse</a> = yes"). This can greatly reduce 584the overhead of connection setup and improves message delivery 585rates. After a Postfix <a href="smtp.8.html">smtp(8)</a> client connects to a remote SMTP 586server and sends plaintext EHLO and STARTTLS commands, the <a href="smtp.8.html">smtp(8)</a> 587client inserts a <a href="tlsproxy.8.html">tlsproxy(8)</a> process into the connection as shown 588below. </p> 589 590<p> After the mail transaction completes, the Postfix <a href="smtp.8.html">smtp(8)</a> client 591gives the <a href="smtp.8.html">smtp(8)</a>-to-<a href="tlsproxy.8.html">tlsproxy(8)</a> connection to the <a href="scache.8.html">scache(8)</a> 592server, which keeps the connection open for a limited amount of 593time. The <a href="smtp.8.html">smtp(8)</a> client continues with some other mail delivery 594request. Meanwhile, any Postfix <a href="smtp.8.html">smtp(8)</a> client can ask the <a href="scache.8.html">scache(8)</a> 595server for that cached connection and reuse it for mail delivery. 596</p> 597 598<table> 599 600<tr> <td> </td> <td> <tt> /-- </tt> </td> <td align="center" 601colspan="3" bgcolor="#f0f0ff"> <a href="smtp.8.html">smtp(8)</a> </td> <td colspan="2"> <tt> 602--> </tt> </td> <td align="center"bgcolor="#f0f0ff"> <a href="tlsproxy.8.html">tlsproxy(8)</a> 603</td> <td> <tt> --> </tt> </td> <td> Internet </td> </tr> 604 605<tr> <td align="center" bgcolor="#f0f0ff"> <a href="qmgr.8.html">qmgr(8)</a> </td> <td> </td> 606<td align="center" rowspan="3"><tt>|<br>|<br>|<br>|<br>v</tt></td> 607</tr> 608 609<tr> <td> </td> <td> <tt> \-- </tt> </td> <td align="center" 610colspan="4" bgcolor="#f0f0ff"> <a href="smtp.8.html">smtp(8)</a> </td> <td align="left"> 611 </td> </tr> 612 613<tr> <td colspan="2"> </td> <td> </td> <td 614align="center"><tt>^<br>|</tt></td> </tr> 615 616<tr> <td colspan="2"> </td> <td align="center" colspan="3" 617bgcolor="#f0f0ff"> <a href="scache.8.html">scache(8)</a> </td> </tr> 618 619</table> 620 621<li> <p> The <a href="showq.8.html">showq(8)</a> servers list the Postfix queue status. This 622is the queue listing service that does the work for the <a href="mailq.1.html">mailq(1)</a> 623and <a href="postqueue.1.html">postqueue(1)</a> commands. </p> 624 625<table> 626 627<tr> <td> Output </td> <td> <tt> <- </tt> </td> <td align="center" 628bgcolor="#f0f0ff"> <a href="mailq.1.html">mailq(1)</a><br> 629 630<a href="postqueue.1.html"> post-<br>queue(1) </a> <br> </td> <td> 631<tt> <- </tt> </td> <td align="center" valign="middle" 632bgcolor="#f0f0ff"> <a href="showq.8.html">showq(8)</a> </td> <td> <tt> <- </tt></td> <td 633align="center" valign="middle" bgcolor="#f0f0ff"> Postfix<br> queue 634</td> </tr> 635 636</table> 637 638<li> <p> The <a href="spawn.8.html">spawn(8)</a> servers run non-Postfix commands on request, 639with the client connected via socket or FIFO to the command's 640standard input, output and error streams. You can find examples of 641its use in the <a href="SMTPD_POLICY_README.html">SMTPD_POLICY_README</a> document. </p> 642 643<li> <p> The <a href="tlsmgr.8.html">tlsmgr(8)</a> server runs when TLS (Transport Layer 644Security, formerly known as SSL) is turned on in the Postfix <a href="smtp.8.html">smtp(8)</a> 645client or <a href="smtpd.8.html">smtpd(8)</a> server. This process has two duties: </p> 646 647<ul> 648 649<li> <p> Maintain the pseudo-random number generator (PRNG) that 650is used to seed the TLS engines in Postfix <a href="smtp.8.html">smtp(8)</a> client or <a href="smtpd.8.html">smtpd(8)</a> 651server processes. The state of this PRNG is periodically saved to 652a file, and is read when <a href="tlsmgr.8.html">tlsmgr(8)</a> starts up. </p> 653 654<li> <p> Maintain the optional Postfix <a href="smtp.8.html">smtp(8)</a> client or <a href="smtpd.8.html">smtpd(8)</a> 655server caches with TLS session keys. Saved keys can improve 656performance by reducing the amount of computation at the start of 657a TLS session. </p> 658 659</ul> 660 661<p> TLS support is available in Postfix version 2.2 and later. 662Information about the Postfix TLS implementation is in the <a href="TLS_README.html">TLS_README</a> 663document. </p> 664 665<table> 666 667<tr> <td>Network<tt>-> </tt> </td> <td align="center" 668bgcolor="#f0f0ff"> <br> <a href="smtpd.8.html">smtpd(8)</a> <br> </td> <td colspan="2"> 669<tt> <---seed---<br><br><-session-> </tt> </td> <td 670align="center" bgcolor="#f0f0ff"> <br> <a href="tlsmgr.8.html">tlsmgr(8)</a> <br> </td> 671<td colspan="3"> <tt> ---seed---><br> <br><-session-> 672</tt> </td> <td align="center" bgcolor="#f0f0ff"> <br> <a href="smtp.8.html">smtp(8)</a> <br> 673 </td> <td> <tt> -></tt>Network </td> </tr> 674 675<tr> <td colspan="3"> </td> <td align="right"> <table> <tr> <td> 676</td> <td> / </td> </tr> <tr> <td> / </td> <td> </td> </tr> </table> 677</td> <td align="center"> |<br> |</td> <td align="left"> <table> 678<tr> <td> \ </td> <td> </td> </tr> <tr> <td> </td> <td> \ </td> 679</tr> </table> </td> <td colspan="3"> </td> </tr> 680 681<tr> <td colspan="2"> </td> <td align="center" bgcolor="#f0f0ff"> 682smtpd<br> session<br> cache </td> <td> </td> <td align="center" 683bgcolor="#f0f0ff"> PRNG<br> state <br>file </td> <td> </td> <td 684align="center" bgcolor="#f0f0ff"> smtp<br> session<br> cache </td> 685<td colspan="2"> </td> </tr> 686 687</table> 688 689 690<li> <p> The <a href="verify.8.html">verify(8)</a> server verifies that a sender or recipient 691address is deliverable before the <a href="smtpd.8.html">smtpd(8)</a> server accepts it. The 692<a href="verify.8.html">verify(8)</a> server queries a cache with address verification results. 693If a result is not found, the <a href="verify.8.html">verify(8)</a> server injects a probe 694message into the Postfix queue and processes the status update from 695a delivery agent or queue manager. 696This process is described in the <a href="ADDRESS_VERIFICATION_README.html">ADDRESS_VERIFICATION_README</a> 697document. The <a href="verify.8.html">verify(8)</a> service is available with Postfix version 6982.1 and later. </p> 699 700<table> 701 702<tr> 703 704 <td rowspan="2" colspan="5" align="center" valign="middle"> 705 </td> <td rowspan="3" align="center" valign="bottom"> 706 <tt> -> </tt> </td> <td rowspan="3" align="center" 707 valign="middle"> probe<br> message </td> <td rowspan="3" 708 align="center" valign="middle"> <tt> -> </tt> </td> <td 709 rowspan="3" bgcolor="#f0f0ff" align="center" valign="middle"> 710 Postfix<br> mail<br> queue </td> 711 712</tr> 713 714<tr> <td> </td> </tr> 715 716<tr> 717 718 <td rowspan="3" align="center" valign="middle"> Network </td> 719 <td rowspan="3" align="center" valign="middle"> <tt> -> </tt> 720 </td> <td rowspan="3" bgcolor="#f0f0ff" align="center" 721 valign="middle"> <a href="smtpd.8.html">smtpd(8)</a> </td> <td rowspan="3" align="center" 722 valign="middle"> <tt> <-> </tt> </td> <td rowspan="3" 723 bgcolor="#f0f0ff" align="center" valign="middle"> <a href="verify.8.html">verify(8)</a> 724 </td> 725 726</tr> 727 728<tr> 729 730 <td rowspan="1" colspan="3"> </td> <td rowspan="1" align="center" 731 valign="middle"> <tt> |</tt><br> <tt> v</tt> </td> 732 733</tr> 734 735<tr> 736 737 <td rowspan="3" align="center" valign="top"> <tt> <- </tt> 738 </td> <td rowspan="3" align="center" valign="middle"> probe<br> 739 status </td> <td rowspan="3" align="center" valign="middle"> 740 <tt> <- </tt> </td> <td rowspan="3" bgcolor="#f0f0ff" 741 align="center" valign="middle"> Postfix<br> delivery<br> agents 742 </td> <td rowspan="3" align="left" valign="middle"> <tt>-></tt> 743 Local<br> <tt>-></tt> Network</td> 744 745</tr> 746 747<tr> 748 749 <td rowspan="3" colspan="4" align="center" valign="middle"> 750 </td> <td rowspan="3" align="center" valign="middle"> 751 <tt> ^</tt><br> <tt> |</tt><br> <tt> v</tt> </td> 752 753</tr> 754 755<tr> <td> </td> </tr> 756 757<tr> <td colspan="4"> </td> </tr> 758 759<tr> 760 761 <td colspan="4" align="center" valign="middle"> </td> 762 <td bgcolor="#f0f0ff" align="center" valign="middle"> Address<br> 763 verification<br> cache </td> 764 765</tr> 766 767</table> 768 769<li> <p> The <a href="postscreen.8.html">postscreen(8)</a> server can be put "in front" of Postfix 770<a href="smtpd.8.html">smtpd(8)</a> processes. Its purpose is to accept connections from the 771network and to decide what SMTP clients are allowed to talk to 772Postfix. According to the 2008 MessageLabs annual report, 81% of 773all email was spam, and 90% of that was sent by botnets; by 2010, 774those numbers were 92% and 95%, respectively. While <a href="postscreen.8.html">postscreen(8)</a> 775keeps the zombies away, more <a href="smtpd.8.html">smtpd(8)</a> processes remain available 776for legitimate clients. </p> 777 778<p> <a href="postscreen.8.html">postscreen(8)</a> maintains a temporary allowlist for clients that 779pass its tests; by allowing allowlisted clients to skip tests, 780<a href="postscreen.8.html">postscreen(8)</a> minimizes its impact on legitimate email traffic. 781</p> 782 783<p> The <a href="postscreen.8.html">postscreen(8)</a> server is available with Postfix 2.8 and 784later. To keep the implementation simple, <a href="postscreen.8.html">postscreen(8)</a> delegates 785DNS allow/denylist lookups to <a href="dnsblog.8.html">dnsblog(8)</a> server processes, and 786delegates TLS encryption/decryption to <a href="tlsproxy.8.html">tlsproxy(8)</a> server processes. 787This delegation is invisible to the remote SMTP client. </p> 788 789<table> 790 791<tr> <td colspan="2"> </td> <td align="center"> zombie </td> </tr> 792 793<tr> <td colspan="3"> </td> <td align="left"> <tt> \ </tt> </td> </tr> 794 795<tr> <td> zombie </td> <td> <tt> - </tt> </td> <td bgcolor="#f0f0ff" align="center"> <a href="tlsproxy.8.html">tlsproxy(8)</a> </td> <td align="left"> <tt> - </tt> </td> <td> 796</td> <td> </td> <td> </td> <td align="right"> <tt> - </tt> </td> 797<td bgcolor="#f0f0ff" align="center"> <a href="smtpd.8.html">smtpd(8)</a> </td> </tr> 798 799<tr> <td colspan="3"> </td> <td align="right"> <tt> \ </tt> </td> <td> </td> 800<td align="left"> <tt> / </tt> </td> </tr> 801 802<tr> <td colspan="2"> </td> <td bgcolor="#f0f0ff" align="center"> other </td> <td> <tt> 803--- </tt> </td> <td bgcolor="#f0f0ff" align="center" valign="middle"> 804<a href="postscreen.8.html">postscreen(8)</a> </td> </tr> 805 806<tr> <td colspan="3"> </td> <td align="right"> <tt> / </tt> </td> <td> </td> 807<td align="right"> <tt> \ </tt> </td> </tr> 808 809<tr> <td colspan="2"> </td> <td bgcolor="#f0f0ff" align="center"> other </td> <td align="left"> 810<tt> - </tt> </td> <td> </td> <td> </td> <td> </td> <td align="right"> 811<tt> - </tt> </td> <td bgcolor="#f0f0ff" align="center"> <a href="smtpd.8.html">smtpd(8)</a> 812</td> </tr> 813 814<tr> <td colspan="3"> </td> <td align="left"> <tt> / </tt> </td> </tr> 815 816<tr> <td colspan="2"> </td> <td align="center"> zombie </td> </tr> 817 818</table> 819 820<li> <p>The <a href="postlogd.8.html">postlogd(8)</a> server provides an alternative to syslog 821logging, which remains the default. This feature is available with 822Postfix version 3.4 or later, and supports the following modes: 823</p> 824 825 826<ul> 827 828<li> <p>Logging to file, which addresses a usability problem with 829MacOS, and eliminates information loss caused by systemd rate limits. 830</p> 831 832<table> 833 834<tr> <td bgcolor="#f0f0ff" rowspan="3" valign="middle" align="center"> 835commands<br>or daemons</td> <td colspan="4"> </td> </tr> 836 837<tr> <td colspan="2"> <td> <tt> -> </tt> </td> <td bgcolor="#f0f0ff"> 838<a href="postlogd.8.html">postlogd(8)</a> </td> <td> <tt> -> </tt> </td> <td> /path/to/file 839</td> </tr> 840 841<tr> <td colspan=6> </td> </tr> 842 843</table> 844 845<li> <p>Logging to stdout, which eliminates a syslog dependency 846when Postfix runs inside a container. </p> 847 848<table> 849 850<tr> <td bgcolor="#f0f0ff" rowspan="3" valign="middle" align="center"> 851commands<br>or daemons</td> <td colspan="4"> </td> <td 852rowspan="3" align="center"> stdout inherited<br>from "postfix 853start-fg" </td> </tr> 854 855<tr> <td colspan="2"> <tt> -> </tt> </td> <td bgcolor="#f0f0ff"> 856<a href="postlogd.8.html">postlogd(8)</a> </td> <td> <tt> -> </tt> </td> </tr> 857 858<tr> <td colspan=5> </td> </tr> 859 860</table> 861 862</ul> 863 864<p> See <a href="MAILLOG_README.html">MAILLOG_README</a> for details and limitations. </p> 865 866</ul> 867 868<h2> <a name="commands"> Postfix support commands </a> </h2> 869 870<p> The Postfix architecture overview ends with a summary of 871command-line utilities for day-to-day use of the Postfix mail 872system. Besides the Sendmail-compatible <a href="sendmail.1.html">sendmail(1)</a>, <a href="mailq.1.html">mailq(1)</a>, and 873<a href="newaliases.1.html">newaliases(1)</a> commands, the Postfix system comes with it own 874collection of command-line utilities. For consistency, these are 875all named post<i>something</i>. </p> 876 877<ul> 878 879<li> <p> The <a href="postfix.1.html">postfix(1)</a> command controls the operation of the mail 880system. It is the interface for starting, stopping, and restarting 881the mail system, as well as for some other administrative operations. 882This command is reserved to the super-user. </p> 883 884<li> <p> The <a href="postalias.1.html">postalias(1)</a> command maintains Postfix <a href="aliases.5.html">aliases(5)</a> type 885databases. This is the program that does the work for the 886<a href="newaliases.1.html">newaliases(1)</a> command. </p> 887 888<li> <p> The <a href="postcat.1.html">postcat(1)</a> command displays the contents of Postfix 889queue files. This is a limited, preliminary utility. This program 890is likely to be superseded by something more powerful that can also 891edit Postfix queue files. </p> 892 893<li> <p> The <a href="postconf.1.html">postconf(1)</a> command displays or updates Postfix <a href="postconf.5.html">main.cf</a> 894parameters and displays system dependent information about the 895supported file locking methods, and the supported types of lookup 896tables. </p> 897 898<li> <p> The <a href="postdrop.1.html">postdrop(1)</a> command is the mail posting utility that 899is run by the Postfix <a href="sendmail.1.html">sendmail(1)</a> command in order to deposit mail 900into the <a href="QSHAPE_README.html#maildrop_queue">maildrop queue</a> directory. </p> 901 902<li> <p> The <a href="postkick.1.html">postkick(1)</a> command makes some Postfix internal 903communication channels available for use in, for example, shell 904scripts. </p> 905 906<li> <p> The <a href="postlock.1.html">postlock(1)</a> command provides Postfix-compatible mailbox 907locking for use in, for example, shell scripts. </p> 908 909<li> <p> The <a href="postlog.1.html">postlog(1)</a> command provides Postfix-compatible logging 910for shell scripts. </p> 911 912<li> <p> The <a href="postmap.1.html">postmap(1)</a> command maintains Postfix lookup tables 913such as <a href="canonical.5.html">canonical(5)</a>, <a href="virtual.5.html">virtual(5)</a> and others. It is a cousin of the 914UNIX makemap command. </p> 915 916<li> <p> The <a href="postmulti.1.html">postmulti(1)</a> command repeats the "postfix start" etc. 917command for each Postfix instance, and supports creation, deletion 918etc. of Postfix instances. For a tutorial, see <a href="MULTI_INSTANCE_README.html">MULTI_INSTANCE_README</a>. 919</p> 920 921<li> <p> The <a href="postqueue.1.html">postqueue(1)</a> command is the privileged command that 922is run by Postfix <a href="sendmail.1.html">sendmail(1)</a> and <a href="mailq.1.html">mailq(1)</a> in order to flush or 923list the 924mail queue. </p> 925 926<li> <p> The <a href="postsuper.1.html">postsuper(1)</a> command maintains the Postfix queue. It 927removes old temporary files, and moves queue files into the right 928directory after a change in the hashing depth of queue directories. 929This command is run at mail system startup time and when Postfix 930is restarted. </p> 931 932</ul> 933 934</body> 935 936</html> 937