| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246 | <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"        "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Postfix Address Rewriting </title><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body><h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">PostfixAddress Rewriting </h1><hr><h2> <a name="purpose"> Postfix address rewriting purpose </a> </h2><p> Address rewriting is at the heart of the Postfix mail system.Postfix rewrites addresses for many different purposes. Some aremerely cosmetic, and some are necessary to deliver correctlyformatted mail to the correct destination. Examples ofaddress rewriting in Postfix are:  </p><ul><li> <p> Transform an incomplete address into a complete address.For example, transform "username" into "username@example.com", ortransform "username@hostname" into "username@hostname.example.com".</p><li> <p> Replace an address by an equivalent address.  For example,replace "username@example.com" by "firstname.lastname@example.com"when sending mail, and do the reverse transformation when receivingmail.  </p><li> <p> Replace an internal address by an external address.  Forexample, replace "username@localdomain.local" by "isp-account@isp.example"when sending mail from a home computer to the Internet.</p><li> <p> Replace an address by multiple addresses. For example,replace the address of an alias by the addresses listed under thatalias.  </p><li> <p> Determine how and where to deliver mail for a specificaddress.  For example, deliver mail for "username@example.com" withthe <a href="smtp.8.html">smtp(8)</a> delivery agent, to the hosts that are listed in theDNS as the mail servers for the domain "example.com". </p></ul><p> Although Postfix currently has no address rewriting language,it can do surprisingly powerful address manipulation via tablelookup.  Postfix typically uses lookup tables with fixed stringsto map one address to one or multiple addresses, and typically usesregular expressions to map multiple addresses to one or multipleaddresses.  Fixed-string lookup tables may be in the form of localfiles, or in the form of NIS, LDAP or SQL databases.  The<a href="DATABASE_README.html">DATABASE_README</a> document gives an introduction to Postfix lookuptables. </p><p> Topics covered in this document: </p><ul><li> <a href="#william"> To rewrite message headers or not, or to labelas invalid </a><li> <a href="#overview"> Postfix address rewriting overview </a><li> <a href="#receiving"> Address rewriting when mail is received</a><ul><li> <a href="#standard"> Rewrite addresses to standard form</a><li> <a href="#canonical"> Canonical address mapping </a><li> <a href="#masquerade"> Address masquerading </a><li> <a href="#auto_bcc"> Automatic BCC recipients</a><li> <a href="#virtual"> Virtual aliasing </a></ul><li> <a href="#delivering"> Address rewriting when mail is delivered</a><ul><li> <a href="#resolve"> Resolve address to destination </a><li> <a href="#transport"> Mail transport switch </a><li> <a href="#relocated"> Relocated users table </a></ul><li> <a href="#remote"> Address rewriting with remote delivery </a><ul><li> <a href="#generic"> Generic mapping for outgoing SMTP mail </a></ul><li> <a href="#local"> Address rewriting with local delivery </a><ul><li> <a href="#aliases"> Local alias database </a><li> <a href="#forward"> Local per-user .forward files </a><li> <a href="#luser_relay"> Local catch-all address </a></ul><li> <a href="#debugging"> Debugging your address manipulations </a></ul><h2> <a name="william"> To rewrite message headers or not, or to labelas invalid </a> </h2><p> Postfix versions 2.1 and earlier always rewrite message headeraddresses, and append Postfix's own domain information to addressesthat Postfix considers incomplete.  While rewriting message headeraddresses is OK for mail with a local origin, it is undesirablefor remote mail: </p><ul><li> Message header address rewriting is frowned upon by mail standards,<li> Appending Postfix's own domain produces incorrect results withsome incomplete addresses,<li> Appending Postfix's own domain sometimes creates the appearancethat spam is sent by local users.</ul><p> Postfix versions 2.2 give you the option to either not rewritemessage headers from remote SMTP clients at all, or to labelincomplete addresses in such message headers as invalid. Here ishow it works:  </p><ul><li> Postfix always rewrites message headers from local SMTP clientsand from the Postfix sendmail command, and appends its own domainto incomplete addresses.  The <a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parametercontrols what SMTP clients Postfix considers local (by default,only local network interface addresses).<li> Postfix never rewrites message header addresses from remoteSMTP clients when the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter valueis empty (the default setting).<li> Otherwise, Postfix rewrites message headers from remote SMTPclients, and appends the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> value toincomplete addresses.  This feature can be used to append a reserveddomain such as "domain.invalid", so that incomplete addresses cannotbe mistaken for local addresses.</ul><h2> <a name="overview"> Postfix address rewriting overview </a> </h2><p> The figure below zooms in on those parts of Postfix that are mostinvolved with address rewriting activity. See the <a href="OVERVIEW.html">OVERVIEW</a> documentfor an overview of the complete Postfix architecture.  Names followedby a number are Postfix daemon programs, while unnumbered namesrepresent Postfix queues or internal sources of mail messages. </p><blockquote><table><tr><td colspan="2"> </td><td bgcolor="#f0f0ff" align="center"> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a><br>(stdform) </td><td colspan="5"> </td><td bgcolor="#f0f0ff" align="center"> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a><br>(resolve)</td></tr><tr><td colspan="2"> </td><td align="center"><table><tr><td align="center"> ^<br> <tt> |</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table><td colspan="5"> </td><td align="center"><table><tr><td align="center"> ^<br> <tt> |</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table><td colspan="2"> </td></tr><tr><td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="smtpd.8.html">smtpd(8)</a></td><td rowspan="3" align="center" valign="middle"> <tt> >- </tt></td><td rowspan="3" bgcolor="#f0f0ff" align="center"> <a href="cleanup.8.html">cleanup(8)</a> </td><td rowspan="3" align="center" valign="middle"> <tt> -> </tt></td><td rowspan="3" bgcolor="#f0f0ff" align="center"> <ahref="QSHAPE_README.html#incoming_queue"> incoming </a> </td><td rowspan="3" align="center" valign="middle"> <tt> -> </tt></td><td rowspan="3" bgcolor="#f0f0ff" align="center"> <ahref="QSHAPE_README.html#active_queue"> active </a> </td><td rowspan="3" align="center" valign="middle"> <tt> -> </tt></td><td rowspan="3" bgcolor="#f0f0ff" align="center"> <a href="qmgr.8.html">qmgr(8)</a> </td><td rowspan="3" align="center" valign="middle"> <tt> -< </tt></td><td bgcolor="#f0f0ff" align="center" valign="middle"><a href="smtp.8.html">smtp(8)</a> </td></tr><tr> <td bgcolor="#f0f0ff" align="center" valign="middle"><a href="qmqpd.8.html">qmqpd(8)</a> </td><td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="lmtp.8.html">lmtp(8)</a> </td></tr><tr><td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="pickup.8.html">pickup(8)</a></td><td bgcolor="#f0f0ff" align="center" valign="middle"> <a href="local.8.html">local(8)</a></td></tr><tr><td colspan="2"> </td><td align="center"> ^<br> <tt> | </tt> </td><td colspan="3"> </td><td align="center"><table><tr><td align="center"> ^<br> <tt> |</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table><td colspan="4"> </td></tr><tr><td colspan="2"> </td><td align="center"> bounces<br> forwarding<br> notices</td><td colspan="3"> </td><td bgcolor="#f0f0ff" align="center"> <ahref="QSHAPE_README.html#deferred_queue"> deferred </a><td colspan="2"> </td></table></blockquote><p> The table below summarizes all Postfix address manipulations.If you're reading this document for the first time, skip forwardto "<a href="ADDRESS_REWRITING_README.html#receiving">Addressrewriting when mail is received</a>". Once you've finished readingthe remainder of this document, the table will help you to quicklyfind what you need.  </p><blockquote><table border="1"><tr> <th nowrap> Address manipulation </th> <th nowrap> Scope </th><th> Daemon </th> <th nowrap> Global turn-on control </th> <th nowrap> Selectiveturn-off control </th> </tr><tr> <td> <a href="#standard"> Rewrite addresses to standard form</a></td> <td nowrap> all mail </td> <td> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> </td><td> <a href="postconf.5.html#append_at_myorigin">append_at_myorigin</a>, <a href="postconf.5.html#append_dot_mydomain">append_dot_mydomain</a>, <a href="postconf.5.html#swap_bangpath">swap_bangpath</a>,<a href="postconf.5.html#allow_percent_hack">allow_percent_hack</a> </td> <td> <a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a>,<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> </td> </tr><tr> <td> <a href="#canonical"> Canonical address mapping </a> </td><td nowrap> all mail </td> <td> <a href="cleanup.8.html">cleanup(8)</a> </td> <td> <a href="postconf.5.html#canonical_maps">canonical_maps</a></td> <td> <a href="postconf.5.html#receive_override_options">receive_override_options</a>, <a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a>,<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> </td> </tr><tr> <td> <a href="#masquerade"> Address masquerading </a> </td> <tdnowrap> all mail </td> <td> <a href="cleanup.8.html">cleanup(8)</a> </td> <td> <a href="postconf.5.html#masquerade_domains">masquerade_domains</a></td> <td> <a href="postconf.5.html#receive_override_options">receive_override_options</a>, <a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a>,<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> </td> </tr><tr> <td> <a href="#auto_bcc"> Automatic BCC recipients </a> </td><td nowrap> new mail </td> <td> <a href="cleanup.8.html">cleanup(8)</a> </td> <td> <a href="postconf.5.html#always_bcc">always_bcc</a>,<a href="postconf.5.html#sender_bcc_maps">sender_bcc_maps</a>, <a href="postconf.5.html#recipient_bcc_maps">recipient_bcc_maps</a> </td> <td> <a href="postconf.5.html#receive_override_options">receive_override_options</a></td> </tr><tr> <td> <a href="#virtual"> Virtual aliasing </a> </td> <tdnowrap> all mail </td> <td> <a href="cleanup.8.html">cleanup(8)</a> </td> <td> <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a></td> <td> <a href="postconf.5.html#receive_override_options">receive_override_options</a> </td> </tr><tr> <td> <a href="#resolve"> Resolve address to destination </a></td> <td nowrap> all mail </td> <td> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> </td><td> none </td> <td> none </td> </tr><tr> <td> <a href="#transport"> Mail transport switch</a> </td><td nowrap> all mail </td> <td> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> </td> <td><a href="postconf.5.html#transport_maps">transport_maps</a> </td> <td> none </td> </tr><tr> <td> <a href="#relocated"> Relocated users table</a> </td><td nowrap> all mail </td> <td> <a href="trivial-rewrite.8.html">trivial-<br>rewrite(8)</a> </td> <td><a href="postconf.5.html#relocated_maps">relocated_maps</a> </td> <td> none </td> </tr><tr> <td> <a href="#generic"> Generic mapping table </a> </td> <td>outgoing SMTP mail </td> <td> <a href="smtp.8.html">smtp(8)</a> </td> <td> <a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a></td> <td> none </td> </tr><tr> <td> <a href="#aliases"> Local alias database</a> </td> <td>local mail only </td> <td> <a href="local.8.html">local(8)</a> </td> <td> <a href="postconf.5.html#alias_maps">alias_maps</a> </td> <td> none</td> </tr><tr> <td> <a href="#forward"> Local per-user .forward files</a></td> <td> local mail only </td> <td> <a href="local.8.html">local(8)</a> </td> <td> <a href="postconf.5.html#forward_path">forward_path</a></td> <td> none </td> </tr><tr> <td> <a href="#luser_relay"> Local catch-all address</a> </td><td> local mail only </td> <td> <a href="local.8.html">local(8)</a> </td> <td> <a href="postconf.5.html#luser_relay">luser_relay</a> </td> <td>none </td> </tr></table></blockquote><h2> <a name="receiving"> Address rewriting when mail is received</a></h2><p> The <a href="cleanup.8.html">cleanup(8)</a> server receives mail from outside of Postfix aswell as mail from internal sources such as forwarded mail,undeliverable mail that is bounced to the sender, and postmasternotifications about problems with the mail system.  </p><p> The <a href="cleanup.8.html">cleanup(8)</a> server transforms the sender, recipients andmessage content into a standard form before writing it to an incomingqueue file. The server cleans up sender and recipient addresses inmessage headers and in the envelope, adds missing message headerssuch as From: or Date: that are required by mail standards, andremoves message headers such as Bcc: that should not be present.The <a href="cleanup.8.html">cleanup(8)</a> server delegates the more complex address manipulationsto the <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> server as described later in this document.</p><p> Address manipulations at this stage are:  </p><ul><li> <a href="#standard"> Rewrite addresses to standard form</a><li> <a href="#canonical"> Canonical address mapping</a><li> <a href="#masquerade"> Address masquerading</a><li> <a href="#auto_bcc"> Automatic BCC recipients</a><li> <a href="#virtual"> Virtual aliasing </a></ul><h3> <a name="standard"> Rewrite addresses to standard form</a> </h3><p> Before the <a href="cleanup.8.html">cleanup(8)</a> daemon runs an address through any addressmapping lookup table, it first rewrites the address to the standard"user@fully.qualified.domain" form, by sending the address to the<a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> daemon.  The purpose of rewriting to standardform is to reduce the number of entries needed in lookup tables.</p><p> The Postfix <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> daemon implements the followinghard-coded address manipulations: </p><blockquote><dl><dt>Rewrite "@hosta,@hostb:user@site" to "user@site"</dt><dd> <p> In case you wonder what this is, the address form aboveis called a route address, and specifies that mail for "user@site"be delivered via "hosta" and "hostb". Usage of this form has beendeprecated for a long time.  Postfix has no ability to handle routeaddresses, other than to strip off the route part.  </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p> </dd><dt>Rewrite "site!user" to "user@site" </dt><dd> <p> This feature is controlled by the boolean <a href="postconf.5.html#swap_bangpath">swap_bangpath</a>parameter (default: yes).  The purpose is to rewrite UUCP-styleaddresses to domain style. This is useful only when you receivemail via UUCP, but it probably does not hurt otherwise. </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p> </dd><dt>Rewrite "user%domain" to "user@domain"</dt><dd> <p> This feature is controlled by the boolean <a href="postconf.5.html#allow_percent_hack">allow_percent_hack</a>parameter (default: yes). Typically, this is used in order to dealwith monstrosities such as "user%domain@otherdomain". </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p> </dd><dt>Rewrite "user" to "user@$<a href="postconf.5.html#myorigin">myorigin</a>" </dt><dd> <p> This feature is controlled by the boolean <a href="postconf.5.html#append_at_myorigin">append_at_myorigin</a>parameter (default: yes).  You should never turn off this feature,because a lot of Postfix components expect that all addresses havethe form "user@domain".  </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter; otherwise they append thedomain name specified with the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a>configuration parameter, if one is specified. To get the behaviorbefore Postfix 2.2, specify "<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> =<a href="DATABASE_README.html#types">static</a>:all". </p><p> If your machine is not the main machine for $<a href="postconf.5.html#myorigin">myorigin</a> and youwish to have some users delivered locally without going via thatmain machine, make an entry in the <a href="#virtual">virtualalias</a> table that redirects "user@$myorigin" to"user@$<a href="postconf.5.html#myhostname">myhostname</a>". See also the "delivering someusers locally" section in the <a href="STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README</a>document. </p> </dd><dt>Rewrite "user@host" to "user@host.$<a href="postconf.5.html#mydomain">mydomain</a>" </dt><dd> <p> This feature is controlled by the boolean <a href="postconf.5.html#append_dot_mydomain">append_dot_mydomain</a>parameter (default: yes).  The purpose is to get consistent treatmentof different forms of the same hostname. </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter; otherwise they append thedomain name specified with the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a>configuration parameter, if one is specified. To get the behaviorbefore Postfix 2.2, specify "<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> =<a href="DATABASE_README.html#types">static</a>:all". </p><p> Some will argue that rewriting "host" to "host.domain"is bad. That is why it can be turned off. Others like the convenienceof having Postfix's own domain appended automatically. </p> </dd><dt>Rewrite "user@site." to "user@site" (without the trailing dot).</dt><dd> <p> A single trailing dot is silently removed. However, anaddress that ends in multiple dots will be rejected as an invalidaddress. </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p> </dd></dl></blockquote><h3> <a name="canonical"> Canonical address mapping </a> </h3><p> The <a href="cleanup.8.html">cleanup(8)</a> daemon uses the <a href="canonical.5.html">canonical(5)</a> tables to rewriteaddresses in message envelopes and in message headers.  By defaultall header and envelope addresses are rewritten; this is controlledwith the <a href="postconf.5.html#canonical_classes">canonical_classes</a> configuration parameter.  </p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p><p> Address rewriting is done for local and remote addresses.  The mapping is useful toreplace login names by "Firstname.Lastname" style addresses, or toclean up invalid domains in mail addresses produced by legacy mailsystems. </p><p> Canonical mapping is disabled by default. To enable, edit the<a href="postconf.5.html#canonical_maps">canonical_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specify one ormore lookup tables, separated by whitespace or commas. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#canonical_maps">canonical_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/canonical/etc/postfix/canonical:    wietse        Wietse.Venema</pre></blockquote><p> For static mappings as shown above, lookup tables such as <a href="DATABASE_README.html#types">hash</a>:,<a href="ldap_table.5.html">ldap</a>:, <a href="mysql_table.5.html">mysql</a>:  or <a href="pgsql_table.5.html">pgsql</a>: are sufficient. For dynamic mappings youcan use regular expression tables. This requires that you becomeintimately familiar with the ideas expressed in <a href="regexp_table.5.html">regexp_table(5)</a>,<a href="pcre_table.5.html">pcre_table(5)</a> and <a href="canonical.5.html">canonical(5)</a>.  </p><p> In addition to the canonical maps which are applied to both senderand recipient addresses, you can specify canonical maps that areapplied only to sender addresses or to recipient addresses. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#sender_canonical_maps">sender_canonical_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/sender_canonical    <a href="postconf.5.html#recipient_canonical_maps">recipient_canonical_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/recipient_canonical</pre></blockquote><p> The sender and recipient canonical maps are applied before thecommon canonical maps. The <a href="postconf.5.html#sender_canonical_classes">sender_canonical_classes</a> and<a href="postconf.5.html#recipient_canonical_classes">recipient_canonical_classes</a> parameters control what addresses aresubject to <a href="postconf.5.html#sender_canonical_maps">sender_canonical_maps</a> and <a href="postconf.5.html#recipient_canonical_maps">recipient_canonical_maps</a>mappings, respectively. </p><p> Sender-specific rewriting is useful when you want to rewriteugly sender addresses to pretty ones, and still want to be able tosend mail to the those ugly address without creating a mailer loop.</p><p> Canonical mapping can be turned off selectively for mail receivedby <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a> settingsin the <a href="master.5.html">master.cf</a> file.  This feature is available in Postfix version2.1 and later.  </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="master.5.html">master.cf</a>:    127.0.0.1:10026    inet  n      -      n      -      -     smtpd        -o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a></pre></blockquote><p> Note: do not specify whitespace around the "=" here. </p><h3> <a name="masquerade"> Address masquerading </a> </h3><p> Address masquerading is a method to hide hosts inside a domainbehind their mail gateway, and to make it appear as if the mailcomes from the gateway itself, instead of from individual machines.</p><p> NOTE: Postfix versions 2.2 and later rewrite message headersfrom remote SMTP clients only if the client matches the<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> parameter, or if the<a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> configuration parameter specifies anon-empty value. To get the behavior before Postfix 2.2, specify"<a href="postconf.5.html#local_header_rewrite_clients">local_header_rewrite_clients</a> = <a href="DATABASE_README.html#types">static</a>:all".  </p><p> Address masquerading is disabled by default, and is implementedby the <a href="cleanup.8.html">cleanup(8)</a> server. To enable, edit the <a href="postconf.5.html#masquerade_domains">masquerade_domains</a>parameter in the <a href="postconf.5.html">main.cf</a> file and specify one or more domain namesseparated by whitespace or commas.  When Postfix tries to masqueradea domain, it processes the list from left to right, and processingstops at the first match.  </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#masquerade_domains">masquerade_domains</a> = foo.example.com example.com</pre></blockquote><p> strips "any.thing.foo.example.com" to "foo.example.com", butstrips "any.thing.else.example.com" to "example.com". </p><p> A domain name prefixed with "<tt>!</tt>" means do not masqueradethis domain or its subdomains: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#masquerade_domains">masquerade_domains</a> = !foo.example.com example.com</pre></blockquote><p> does not change "any.thing.foo.example.com" and "foo.example.com",but strips "any.thing.else.example.com" to "example.com". </p><p> The <a href="postconf.5.html#masquerade_exceptions">masquerade_exceptions</a> configuration parameter specifieswhat user names should not be subjected to address masquerading.Specify one or more user names separated by whitespace or commas.</p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#masquerade_exceptions">masquerade_exceptions</a> = root</pre></blockquote><p> By default, Postfix makes no exceptions. </p><p> Subtle point: by default, address masquerading is applied only tomessage headers and to envelope sender addresses, but not to enveloperecipients. This allows you to use address masquerading on a mailgateway machine, while still being able to forward mail from outsideto users on individual machines. </p><p> In order to subject envelope recipient addresses to masquerading,too, specify (Postfix version 1.1 and later):</p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#masquerade_classes">masquerade_classes</a> = envelope_sender, envelope_recipient,        header_sender, header_recipient</pre></blockquote><p> If you rewrite the envelope recipient like this, Postfix willno longer be able to send mail to individual machines. </p><p> Address masquerading can be turned off selectively for mailreceived by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a>settings in the <a href="master.5.html">master.cf</a> file.  This feature is available inPostfix version 2.1 and later. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="master.5.html">master.cf</a>:    127.0.0.1:10026    inet  n      -      n      -      -     smtpd        -o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a></pre></blockquote><p> Note: do not specify whitespace around the "=" here. </p><h3> <a name="auto_bcc"> Automatic BCC recipients</a> </h3><p> After applying the canonical and masquerade mappings, the<a href="cleanup.8.html">cleanup(8)</a> daemon can generate optional BCC (blind carbon-copy)recipients. Postfix provides three mechanisms: </p><blockquote><dl><dt> <a href="postconf.5.html#always_bcc">always_bcc</a> = address </dt> <dd> Deliver a copy of all mail tothe specified address. In Postfix versions before 2.1, this featureis implemented by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>. </dd><dt> <a href="postconf.5.html#sender_bcc_maps">sender_bcc_maps</a> = <a href="DATABASE_README.html">type:table</a>  </dt> <dd> Search the specified"<a href="DATABASE_README.html">type:table</a>" lookup table with the envelope sender address for anautomatic BCC address. This feature is available in Postfix 2.1and later. </dd><dt> <a href="postconf.5.html#recipient_bcc_maps">recipient_bcc_maps</a> = <a href="DATABASE_README.html">type:table</a>  </dt> <dd> Search the specified"<a href="DATABASE_README.html">type:table</a>" lookup table with the envelope recipient address foran automatic BCC address. This feature is available in Postfix 2.1and later. </dd></dl></blockquote><p> Note: automatic BCC recipients are produced only for new mail.To avoid mailer loops, automatic BCC recipients are not generatedfor mail that Postfix forwards internally, nor for mail that Postfixgenerates itself. </p><p> Automatic BCC recipients (including <a href="postconf.5.html#always_bcc">always_bcc</a>) can be turnedoff selectively for mail received by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>,by overriding <a href="postconf.5.html">main.cf</a> settings in the <a href="master.5.html">master.cf</a> file.  This featureis available in Postfix version 2.1 and later. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="master.5.html">master.cf</a>:    127.0.0.1:10026    inet  n      -      n      -      -     smtpd        -o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a></pre></blockquote><p> Note: do not specify whitespace around the "=" here. </p><h3> <a name="virtual"> Virtual aliasing </a> </h3><p> Before writing the recipients to the queue file, the <a href="cleanup.8.html">cleanup(8)</a>daemon uses the optional <a href="virtual.5.html">virtual(5)</a> alias tables to redirect mailfor recipients.  The mapping affects only envelope recipientaddresses; it has no effect on message headers or envelope senderaddresses.  Virtual alias lookups are useful to redirect mail for<a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domains</a> to real user mailboxes, and to redirect mailfor domains that no longer exist.  Virtual alias lookups can alsobe used to transform " Firstname.Lastname " back into UNIX loginnames, although it seems that local <a href="#aliases">aliases</a>may be a more appropriate vehicle. See the <a href="VIRTUAL_README.html">VIRTUAL_README</a> documentfor an overview of methods to host virtual domains with Postfix.</p><p> Virtual aliasing is disabled by default. To enable, edit the<a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file andspecify one or more lookup tables, separated by whitespace orcommas. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/virtual/etc/postfix/virtual:    Wietse.Venema        wietse</pre></blockquote><p> Addresses found in virtual alias maps are subjected to anotheriteration of virtual aliasing, but are not subjected to canonicalmapping, in order to avoid loops. </p><p> For static mappings as shown above, lookup tables such as <a href="DATABASE_README.html#types">hash</a>:,<a href="ldap_table.5.html">ldap</a>:, <a href="mysql_table.5.html">mysql</a>: or <a href="pgsql_table.5.html">pgsql</a>: are sufficient. For dynamic mappings youcan use regular expression tables. This requires that you becomeintimately familiar with the ideas expressed in <a href="regexp_table.5.html">regexp_table(5)</a>,<a href="pcre_table.5.html">pcre_table(5)</a> and <a href="virtual.5.html">virtual(5)</a>.  </p><p> Virtual aliasing can be turned off selectively for mail receivedby <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a> settingsin the <a href="master.5.html">master.cf</a> file.  This feature is available in Postfix version2.1 and later. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="master.5.html">master.cf</a>:    127.0.0.1:10026    inet  n      -      n      -      -     smtpd        -o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a></pre></blockquote><p> Note: do not specify whitespace around the "=" here. </p><p> At this point the message is ready to be stored into thePostfix <a href="QSHAPE_README.html#incoming_queue">incoming queue</a>. </p><h2> <a name="delivering"> Address rewriting when mail is delivered</a> </h2><p> The Postfix queue manager sorts mail according to its destinationand gives it to Postfix delivery agents such as <a href="local.8.html">local(8)</a>, <a href="smtp.8.html">smtp(8)</a>,or <a href="lmtp.8.html">lmtp(8)</a>. Just like the <a href="cleanup.8.html">cleanup(8)</a> server, the Postfix queuemanager delegates the more complex address manipulations to the<a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> server. </p><p> Address manipulations at this stage are:  </p><ul><li> <a href="#resolve"> Resolve address to destination </a><li> <a href="#transport"> Mail transport switch</a><li> <a href="#relocated"> Relocated users table</a></ul><p> Each Postfix delivery agent tries to deliver the mail to itsdestination, while encapsulating the sender, recipients, and messagecontent according to the rules of the SMTP, LMTP, etc.  protocol.When mail cannot be delivered, it is either returned to the senderor moved to the <a href="QSHAPE_README.html#deferred_queue">deferred queue</a> and tried again later.  </p><p> <a name="remote">Address</a> manipulations when mail is deliveredvia the <a href="smtp.8.html">smtp(8)</a> delivery agent: </p><ul><li> <a href="#generic"> Generic mapping for outgoing SMTP mail </a></ul><p> <a name="local">Address</a> manipulations when mail is deliveredvia the <a href="local.8.html">local(8)</a> delivery agent: </p><ul><li> <a href="#aliases"> Local alias database</a><li> <a href="#forward"> Local per-user .forward files</a><li> <a href="#luser_relay"> Local catch-all address</a></ul><p> The remainder of this document presents each address manipulationstep in more detail, with specific examples or with pointers todocumentation with examples. </p><h3> <a name="resolve"> Resolve address to destination </a> </h3><p> The Postfix <a href="qmgr.8.html">qmgr(8)</a> queue manager selects new mail from the<a href="QSHAPE_README.html#incoming_queue">incoming queue</a> or old mail from the <a href="QSHAPE_README.html#deferred_queue">deferred queue</a>, and asks the<a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> address rewriting and resolving daemon where itshould be delivered. </p><p> As of version 2.0, Postfix distinguishes four major addressclasses. Each class has its own list of domain names, and eachclass has its own default delivery method, as shown in the tablebelow.  See the <a href="ADDRESS_CLASS_README.html">ADDRESS_CLASS_README</a> document for the fine details.Postfix versions before 2.0 only distinguish between local deliveryand everything else.  </p><blockquote><table border="1"><tr><th align="left">Destination domain list </th> <thalign="left">Default delivery method </th> <th>Availability</th> </tr><tr><td>$<a href="postconf.5.html#mydestination">mydestination</a>, $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a>, $<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> </td><td>$<a href="postconf.5.html#local_transport">local_transport</a> </td> <td>Postfix 1.0</td></tr><tr><td>$<a href="postconf.5.html#virtual_mailbox_domains">virtual_mailbox_domains</a> </td> <td>$<a href="postconf.5.html#virtual_transport">virtual_transport</a> </td><td>Postfix 2.0</td> </tr><tr><td>$<a href="postconf.5.html#relay_domains">relay_domains</a> </td> <td>$<a href="postconf.5.html#relay_transport">relay_transport</a> </td> <td>Postfix2.0</td> </tr><tr><td>none </td> <td>$<a href="postconf.5.html#default_transport">default_transport</a> </td> <td>Postfix 1.0</td></tr></table></blockquote><h3> <a name="transport"> Mail transport switch </a> </h3><p> Once the <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> daemon has determined a defaultdelivery method it searches the optional <a href="transport.5.html">transport(5)</a> table forinformation that overrides the message destination and/or deliverymethod.  Typical use of the <a href="transport.5.html">transport(5)</a> table is to send mail toa systemthat is not connected to the Internet, or to use a special SMTPclient configuration for destinations that have special requirements.See, for example, the <a href="STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README</a> and <a href="UUCP_README.html">UUCP_README</a>documents, and the examples in the <a href="transport.5.html">transport(5)</a> manual page.  </p><p> Transport table lookups are disabled by default. To enable,edit the <a href="postconf.5.html#transport_maps">transport_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specifyone or more lookup tables, separated by whitespace or commas. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#transport_maps">transport_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/transport</pre></blockquote><h3> <a name="relocated"> Relocated users table </a> </h3><p> Next, the <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a> address rewriting and resolvingdaemon runs each recipient through the <a href="relocated.5.html">relocated(5)</a> database.  Thistable provides information on how to reach users that no longerhave an account, or what to do with mail for entire domains thatno longer exist.  When mail is sent to an address that is listedin this table, the message is returned to the sender with aninformative message.  </p><p> The <a href="relocated.5.html">relocated(5)</a> database is searched after <a href="transport.5.html">transport(5)</a>table lookups, in anticipation of <a href="transport.5.html">transport(5)</a> tables thatcan replace one recipient address by a different one. </p><p> Lookups of relocated users are disabled by default. To enable,edit the <a href="postconf.5.html#relocated_maps">relocated_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specifyone or more lookup tables, separated by whitespace or commas. </p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#relocated_maps">relocated_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/relocated/etc/postfix/relocated:    username@example.com      otheruser@elsewhere.tld</pre></blockquote><p> As of Postfix version 2, mail for a relocated user will berejected by the SMTP server with the reason "user has moved tootheruser@elsewhere.tld". Older Postfix versions will receive themail first, and then return it to the sender as undeliverable, withthe same reason.  </p><h3> <a name="generic"> Generic mapping for outgoing SMTP mail </a> </h3><p> Some hosts have no valid Internet domain name, and instead usea name such as <i>localdomain.local</i>. This can be a problem whenyou want to send mail over the Internet, because many mail serversreject mail addresses with invalid domain names. </p><p> With the <a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a> parameter you can specify <a href="generic.5.html">generic(5)</a>lookup tables that replace local mail addresses by valid Internetaddresses when mail leaves the machine via SMTP. The <a href="generic.5.html">generic(5)</a>mapping replaces envelope and header addresses, and is non-recursive.It does not happen when you send mail between addresses on thelocal machine. </p><p> This feature is available in Postfix version 2.2 and later.</p><p> Example: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/generic/etc/postfix/generic:    his@localdomain.local               hisaccount@hisisp.example    her@localdomain.local               heraccount@herisp.example    @localdomain.local                  hisaccount+local@hisisp.example</pre></blockquote><p> When mail is sent to a remote host via SMTP, this replaces<i>his@localdomain.local</i> by his ISP mail address, replaces<i>her@localdomain.local</i> by her ISP mail address, and replacesother local addresses by his ISP account, with an address extensionof +<i>local</i> (this example assumes that the ISP supports "+"style address extensions).  </p><h3> <a name="aliases"> Local alias database </a> </h3><p> When mail is to be delivered locally, the <a href="local.8.html">local(8)</a> deliveryagent runs each local recipient name through the <a href="aliases.5.html">aliases(5)</a> database.The mapping does not affect addresses in message headers. Localaliases are typically used to implement distribution lists, or todirect mail for standard aliases such as postmaster to real people.The table can also be used to map "Firstname.Lastname" addressesto login names. </p><p> Alias lookups are enabled by default. The default configurationdepends on the operating system environment, but it is typicallyone of the following: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#alias_maps">alias_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/aliases    <a href="postconf.5.html#alias_maps">alias_maps</a> = <a href="DATABASE_README.html#types">dbm</a>:/etc/aliases, nis:mail.aliases</pre></blockquote><p> The pathname of the alias database file is controlled with the<a href="postconf.5.html#alias_database">alias_database</a> configuration parameter. The value is system dependent.Usually it is one of the following: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#alias_database">alias_database</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/aliases (4.4BSD, LINUX)    <a href="postconf.5.html#alias_database">alias_database</a> = <a href="DATABASE_README.html#types">dbm</a>:/etc/aliases (4.3BSD, SYSV<4)    <a href="postconf.5.html#alias_database">alias_database</a> = <a href="DATABASE_README.html#types">dbm</a>:/etc/mail/aliases (SYSV4)</pre></blockquote><p> An <a href="aliases.5.html">aliases(5)</a> file can specify that mail should be deliveredto a local file, or to a command that receives the message in thestandard input stream.  For security reasons, deliveries to commandand file destinations are performed with the rights of the aliasdatabase owner.  A default userid, <a href="postconf.5.html#default_privs">default_privs</a>, is used fordeliveries to commands or files in "root"-owned aliases. </p><h3> <a name="forward"> Local per-user .forward files </a> </h3><p> With delivery via the <a href="local.8.html">local(8)</a> delivery agent, users can controltheir own mail delivery by specifying destinations in a file called.forward in their home directories. The syntax of these files isthe same as with the local <a href="aliases.5.html">aliases(5)</a> file, except that the left-handside of the alias (lookup key and colon) are not present. </p><h3> <a name="luser_relay"> Local catch-all address </a> </h3><p> When the <a href="local.8.html">local(8)</a> delivery agent finds that a message recipientdoes not exist, the message is normally returned to the sender ("userunknown").  Sometimes it is desirable to forward mail for non-existingrecipients to another machine.  For this purpose you can specifyan alternative destination with the <a href="postconf.5.html#luser_relay">luser_relay</a> configurationparameter. </p><p> Alternatively, mail for non-existent recipients can be delegatedto an entirely different message transport, as specified with the<a href="postconf.5.html#fallback_transport">fallback_transport</a> configuration parameter. For details, see the<a href="local.8.html">local(8)</a> delivery agent documentation. </p><p> Note: if you use the <a href="postconf.5.html#luser_relay">luser_relay</a> feature in order to receivemail for non-UNIX accounts, then you must specify: </p><blockquote><pre>/etc/postfix/<a href="postconf.5.html">main.cf</a>:    <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> =</pre></blockquote><p> (i.e. empty) in the <a href="postconf.5.html">main.cf</a> file, otherwise the Postfix SMTPserver will reject mail for non-UNIX accounts with "User unknownin local recipient table". See the <a href="LOCAL_RECIPIENT_README.html">LOCAL_RECIPIENT_README</a> filefor more information on this.</p><p> <a href="postconf.5.html#luser_relay">luser_relay</a> can specify one address. It is subjected to "$name"expansions. Examples: </p><blockquote><dl><dt>$user@other.host </dt><dd> <p> The bare username, without address extension, is prependedto "@other.host". For example, mail for "username+foo" is sent to"username@other.host". </p> </dd><dt>$local@other.host </dt><dd> <p> The entire original recipient localpart, including addressextension, is prepended to "@other.host". For example, mail for"username+foo" is sent to "username+foo@other.host". </p> </dd><dt>sysadmin+$user </dt><dd> <p> The bare username, without address extension, is appendedto "sysadmin". For example, mail for "username+foo" is sent to"sysadmin+username". </p> </dd><dt>sysadmin+$local </dt><dd> <p> The entire original recipient localpart, including addressextension, is appended to "sysadmin". For example, mail for"username+foo" is sent to "sysadmin+username+foo". </p> </dd></dl></blockquote><h2> <a name="debugging"> Debugging your address manipulations </a> </h2><p> Postfix version 2.1 and later canproduce mail delivery reports for debugging purposes. These reportsnot only show sender/recipient addresses after address rewritingand alias expansion or forwarding, they also show information aboutdelivery to mailbox, delivery to non-Postfix command, responsesfrom remote SMTP servers, and so on.  </p><p> Postfix can produce two types of mail delivery reports fordebugging: </p><ul><li> <p> What-if: report what would happen, but do not actuallydeliver mail. This mode of operation is requested with: </p><pre>$ <b>/usr/sbin/sendmail -bv address...</b>Mail Delivery Status Report will be mailed to <your login name>.</pre><li> <p> What happened: deliver mail and report successes and/orfailures, including replies from remote SMTP servers.  This modeof operation is requested with: </p><pre>$ <b>/usr/sbin/sendmail -v address...</b>Mail Delivery Status Report will be mailed to <your login name>.</pre></ul><p> These reports contain information that is generated by Postfixdelivery agents. Since these run as daemon processes and do notinteract with users directly, the result is sent as mail to thesender of the test message. The format of these reports is practicallyidentical to that of ordinary non-delivery notifications. </p><p> As an example, below is the delivery report that is producedwith the command "sendmail -bv postfix-users@postfix.org".  Thefirst part of the report contains human-readable text. In thiscase, mail would be delivered via mail.cloud9.net, and the SMTPserver replies with "250 Ok". Other reports may show deliveryto mailbox, or delivery to non-Postfix command. </p><blockquote><pre>Content-Description: NotificationContent-Type: text/plainThis is the mail system at host spike.porcupine.org.Enclosed is the mail delivery report that you requested.                        The mail system<postfix-users@postfix.org>: delivery via mail.cloud9.net[168.100.1.4]: 250 2.1.5 Ok</pre></blockquote><p> The second part of the report is in machine-readable form, andincludes the following information: </p><ul><li> The envelope sender address (wietse@porcupine.org).<li> The envelope recipient address (postfix-users@postfix.org).If the recipient address was changed by Postfix then Postfix alsoincludes the original recipient address.<li> The delivery status.</ul><p> Some details depend on Postfix version. The example below isfor Postfix version 2.3 and later. </p><blockquote><pre>Content-Description: Delivery reportContent-Type: message/delivery-statusReporting-MTA: dns; spike.porcupine.orgX-Postfix-Queue-ID: 84863BC0E5X-Postfix-Sender: rfc822; wietse@porcupine.orgArrival-Date: Sun, 26 Nov 2006 17:01:01 -0500 (EST)Final-Recipient: rfc822; postfix-users@postfix.orgAction: deliverableStatus: 2.1.5Remote-MTA: dns; mail.cloud9.netDiagnostic-Code: smtp; 250 2.1.5 Ok</pre></blockquote><p> The third part of the report contains the message that Postfixwould have delivered, including From:  and To: message headers, sothat you can see any effects of address rewriting on those. Mailsubmitted with "sendmail -bv" has no body content so none is shownin the example below. </p><blockquote><pre>Content-Description: MessageContent-Type: message/rfc822Received: by spike.porcupine.org (Postfix, from userid 1001)        id 84863BC0E5; Sun, 26 Nov 2006 17:01:01 -0500 (EST)Subject: probeTo: postfix-users@postfix.orgMessage-Id: <20061126220101.84863BC0E5@spike.porcupine.org>Date: Sun, 26 Nov 2006 17:01:01 -0500 (EST)From: wietse@porcupine.org (Wietse Venema)</pre></blockquote></body></html>
 |