xref: /netbsd-src/external/ibm-public/postfix/dist/proto/STANDARD_CONFIGURATION_README.html (revision ba65fde2d7fefa7d39838fa5fa855e62bd606b5e)
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 Standard Configuration Examples</title>
9
10<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
11
12</head>
13
14<body>
15
16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix Standard Configuration Examples</h1>
17
18<hr>
19
20<h2>Purpose of this document</h2>
21
22<p> This document presents a number of typical Postfix configurations.
23This document should be reviewed after you have followed the basic
24configuration steps as described in the BASIC_CONFIGURATION_README
25document. In particular, do not proceed here if you don't already
26have Postfix working for local mail submission and for local mail
27delivery. </p>
28
29<p> The first part of this document presents standard configurations
30that each solve one specific problem. </p>
31
32<ul>
33
34<li><a href="#stand_alone">Postfix on a stand-alone Internet host</a>
35
36<li><a href="#null_client">Postfix on a null client</a>
37
38<li><a href="#local_network">Postfix on a local network</a>
39
40<li><a href="#firewall">Postfix email firewall/gateway</a>
41
42</ul>
43
44<p> The second part of this document presents additional configurations
45for hosts in specific environments. </p>
46
47<ul>
48
49<li><a href="#some_local">Delivering some but not all accounts locally</a>
50
51<li><a href="#intranet">Running Postfix behind a firewall</a>
52
53<li><a href="#backup">Configuring Postfix as primary or backup MX host for a remote
54site</a>
55
56<li><a href="#dialup">Postfix on a dialup machine</a>
57
58<li><a href="#fantasy">Postfix on hosts without a real
59Internet hostname</a>
60
61</ul>
62
63<h2><a name="stand_alone">Postfix on a stand-alone Internet host</a></h2>
64
65<p> Postfix should work out of the box without change on a stand-alone
66machine that has direct Internet access.  At least, that is how
67Postfix installs when you download the Postfix source code via
68http://www.postfix.org/. </p>
69
70<p> You can use the command "<b>postconf -n</b>" to find out what
71settings are overruled by your main.cf. Besides a few pathname
72settings, few parameters should be set on a stand-alone box, beyond
73what is covered in the BASIC_CONFIGURATION_README document: </p>
74
75<blockquote>
76<pre>
77/etc/postfix/main.cf:
78    # Optional: send mail as user@domainname instead of user@hostname.
79    #myorigin = $mydomain
80
81    # Optional: specify NAT/proxy external address.
82    #proxy_interfaces = 1.2.3.4
83
84    # Alternative 1: don't relay mail from other hosts.
85    mynetworks_style = host
86    relay_domains =
87
88    # Alternative 2: relay mail from local clients only.
89    # mynetworks = 192.168.1.0/28
90    # relay_domains =
91</pre>
92</blockquote>
93
94<p> See also the section "<a href="#fantasy">Postfix on hosts without
95a real Internet hostname</a>" if this is applicable to your configuration.
96</p>
97
98<h2><a name="null_client">Postfix on a null client</a></h2>
99
100<p> A null client is a machine that can only send mail. It receives no
101mail from the network, and it does not deliver any mail locally. A
102null client typically uses POP, IMAP or NFS for mailbox access. </p>
103
104<p> In this example we assume that the Internet domain name is
105"example.com" and that the machine is named "nullclient.example.com".
106As usual, the examples show only parameters that are not left at
107their default settings. </p>
108
109<blockquote>
110<pre>
1111 /etc/postfix/main.cf:
1122     myorigin = $mydomain
1133     relayhost = $mydomain
1144     inet_interfaces = loopback-only
1155     local_transport = error:local delivery is disabled
1166
1177 /etc/postfix/master.cf:
1188     Comment out the local delivery agent entry
119</pre>
120</blockquote>
121
122<p> Translation: </p>
123
124<ul>
125
126<li> <p> Line 2: Send mail as "user@example.com" (instead of
127"user@nullclient.example.com"), so that nothing ever has a reason
128to send mail to "user@nullclient.example.com". </p>
129
130<li> <p> Line 3: Forward all mail to the mail server that is
131responsible for the "example.com" domain. This prevents mail from
132getting stuck on the null client if it is turned off while some
133remote destination is unreachable. </p>
134
135<li> <p> Line 4: Do not accept mail from the network. </p>
136
137<li> <p> Lines 5-8: Disable local mail delivery. All mail goes to
138the mail server as specified in line 3.  </p>
139
140</ul>
141
142<h2><a name="local_network">Postfix on a local network</a></h2>
143
144<p> This section describes a local area network environment of one
145main server and multiple other systems that send and receive email.
146As usual we assume that the Internet domain name is "example.com".
147All systems are configured to send mail as "user@example.com", and
148all systems receive mail for "user@hostname.example.com".  The main
149server also receives mail for "user@example.com". We call this
150machine by the name of mailhost.example.com. </p>
151
152<p> A drawback of sending mail as "user@example.com" is that mail
153for "root" and other system accounts is also sent to the central
154mailhost. See the section "<a href="#some_local">Delivering some
155but not all accounts locally</a>" below for possible solutions.
156</p>
157
158<p> As usual, the examples show only parameters that are not left
159at their default settings. </p>
160
161<p> First we present the non-mailhost configuration, because it is
162the simpler one. This machine sends mail as "user@example.com" and
163is final destination for "user@hostname.example.com". </p>
164
165<blockquote>
166<pre>
1671 /etc/postfix/main.cf:
1682     myorigin = $mydomain
1693     mynetworks = 127.0.0.0/8 10.0.0.0/24
1704     relay_domains =
1715     # Optional: forward all non-local mail to mailhost
1726     #relayhost = $mydomain
173</pre>
174</blockquote>
175
176<p> Translation: </p>
177
178<ul>
179
180<li> <p> Line 2: Send mail as "user@example.com". </p>
181
182<li> <p> Line 3: Specify the trusted networks. </p>
183
184<li> <p> Line 4: This host does not relay mail from untrusted networks. </p>
185
186<li> <p> Line 6: This is needed if no direct Internet access is
187available.  See also below, "<a href="#firewall">Postfix behind
188a firewall</a>". </p>
189
190</ul>
191
192<p> Next we present the mailhost configuration.  This machine sends
193mail as "user@example.com" and is final destination for
194"user@hostname.example.com" as well as "user@example.com". </p>
195
196<blockquote>
197<pre>
198 1 DNS:
199 2     example.com    IN    MX  10 mailhost.example.com.
200 3
201 4 /etc/postfix/main.cf:
202 5     myorigin = $mydomain
203 6     mydestination = $myhostname localhost.$mydomain localhost $mydomain
204 7     mynetworks = 127.0.0.0/8 10.0.0.0/24
205 8     relay_domains =
206 9     # Optional: forward all non-local mail to firewall
20710     #relayhost = [firewall.example.com]
208</pre>
209</blockquote>
210
211<p> Translation: </p>
212
213<ul>
214
215<li> <p> Line 2: Send mail for the domain "example.com" to the
216machine mailhost.example.com.  Remember to specify the "." at the
217end of the line. </p>
218
219<li> <p> Line 5: Send mail as "user@example.com". </p>
220
221<li> <p> Line 6: This host is the final mail destination for the
222"example.com" domain, in addition to the names of the machine
223itself. </p>
224
225<li> <p> Line 7: Specify the trusted networks. </p>
226
227<li> <p> Line 8: This host does not relay mail from untrusted networks. </p>
228
229<li> <p> Line 10: This is needed only when the mailhost has to
230forward non-local mail via a mail server on a firewall.  The
231<tt>[]</tt> forces Postfix to do no MX record lookups. </p>
232
233</ul>
234
235<p> In an environment like this, users access their mailbox in one
236or more of the following ways:
237
238<ul>
239
240<li> <p> Mailbox access via NFS or equivalent.  </p>
241
242<li> <p> Mailbox access via POP or IMAP. </p>
243
244<li> <p> Mailbox on the user's preferred machine. </p>
245
246</ul>
247
248<p> In the latter case, each user has an alias on the mailhost that
249forwards mail to her preferred machine: </p>
250
251<blockquote>
252<pre>
253/etc/aliases:
254    joe:    joe@joes.preferred.machine
255    jane:   jane@janes.preferred.machine
256</pre>
257</blockquote>
258
259<p> On some systems the alias database is not in /etc/aliases.  To
260find out the location for your system, execute the command "<b>postconf
261alias_maps</b>". </p>
262
263<p> Execute the command "<b>newaliases</b>" whenever you change
264the aliases file.  </p>
265
266<h2><a name="firewall">Postfix email firewall/gateway</a></h2>
267
268<p> The idea is to set up a Postfix email firewall/gateway that
269forwards mail for "example.com" to an inside gateway machine but
270rejects mail for "anything.example.com". There is only one problem:
271with "relay_domains = example.com", the firewall normally also
272accepts mail for "anything.example.com".  That would not be right.
273</p>
274
275<p> Note: this example requires Postfix version 2.0 and later. To find
276out what Postfix version you have, execute the command "<b>postconf
277mail_version</b>". </p>
278
279<p> The solution is presented in multiple parts. This first part
280gets rid of local mail delivery on the firewall, making the firewall
281harder to break. </p>
282
283<blockquote>
284<pre>
2851 /etc/postfix/main.cf:
2862     myorigin = example.com
2873     mydestination =
2884     local_recipient_maps =
2895     local_transport = error:local mail delivery is disabled
2906
2917 /etc/postfix/master.cf:
2928     Comment out the local delivery agent
293</pre>
294</blockquote>
295
296<p> Translation: </p>
297
298<ul>
299
300<li> <p> Line 2: Send mail from this machine as "user@example.com",
301so that no reason exists to send mail to "user@firewall.example.com".
302</p>
303
304<li> <p> Lines 3-8: Disable local mail delivery on the firewall
305machine. </p>
306
307</ul>
308
309<p> For the sake of technical correctness the firewall must be able
310to receive mail for postmaster@[firewall ip address]. Reportedly,
311some things actually expect this ability to exist. The second part
312of the solution therefore adds support for postmaster@[firewall ip
313address], and as a bonus we do abuse@[firewall ip address] as well.
314All the mail to these two accounts is forwarded to an inside address.
315</p>
316
317<blockquote>
318<pre>
3191 /etc/postfix/main.cf:
3202     virtual_alias_maps = hash:/etc/postfix/virtual
3213
3224 /etc/postfix/virtual:
3235     postmaster      postmaster@example.com
3246     abuse           abuse@example.com
325</pre>
326</blockquote>
327
328<p> Translation: </p>
329
330<ul>
331
332<li> <p> Because mydestination is empty (see the previous example),
333only address literals matching $inet_interfaces or $proxy_interfaces
334are deemed local.  So "localpart@[a.d.d.r]" can be matched as simply
335"localpart" in canonical(5) and virtual(5). This avoids the need to
336specify firewall IP addresses into Postfix configuration files. </p>
337
338</ul>
339
340<p> The last part of the solution does the email forwarding, which
341is the real purpose of the firewall email function. </p>
342
343<blockquote>
344<pre>
345 1 /etc/postfix/main.cf:
346 2     mynetworks = 127.0.0.0/8 12.34.56.0/24
347 3     relay_domains = example.com
348 4     parent_domain_matches_subdomains =
349 5         debug_peer_list smtpd_access_maps
350 6     smtpd_recipient_restrictions =
351 7         permit_mynetworks reject_unauth_destination
352 8
353 9     relay_recipient_maps = hash:/etc/postfix/relay_recipients
35410     transport_maps = hash:/etc/postfix/transport
35511
35612 /etc/postfix/relay_recipients:
35713     user1@example.com   x
35814     user2@example.com   x
35915      . . .
36016
36117 /etc/postfix/transport:
36218     example.com   smtp:[inside-gateway.example.com]
363</pre>
364</blockquote>
365
366<p> Translation: </p>
367
368<ul>
369
370<li><p> Lines 1-7: Accept mail from local systems in $mynetworks,
371and accept mail from outside for "user@example.com" but not for
372"user@anything.example.com". The magic is in lines 4-5. </p>
373
374<li> <p> Lines 9, 12-14: Define the list of valid addresses in the
375"example.com" domain that can receive mail from the Internet. This
376prevents the mail queue from filling up with undeliverable
377MAILER-DAEMON messages. If you can't maintain a list of valid
378recipients then you must specify "relay_recipient_maps =" (that
379is, an empty value), or you must specify an "@example.com  x"
380wild-card in the relay_recipients table. </p>
381
382<li> <p> Lines 10, 17-18: Route mail for "example.com" to the inside
383gateway machine. The <tt>[]</tt> forces Postfix to do no MX lookup.
384</p>
385
386</ul>
387
388<p>Specify <b>dbm</b> instead of <b>hash</b> if your system uses
389<b>dbm</b> files instead of <b>db</b> files. To find out what lookup
390tables Postfix supports, use the command "<b>postconf -m</b>".  </p>
391
392<p> Execute the command "<b>postmap /etc/postfix/relay_recipients</b>"
393whenever you change the relay_recipients table. </p>
394
395<p> Execute the command "<b>postmap /etc/postfix/transport</b>"
396whenever you change the transport table. </p>
397
398<p> In some installations, there may be separate instances of Postfix
399processing inbound and outbound mail on a multi-homed firewall. The
400inbound Postfix instance has an SMTP server listening on the external
401firewall interface, and the outbound Postfix instance has an SMTP server
402listening on the internal interface. In such a configuration is it is
403tempting to configure $inet_interfaces in each instance with just the
404corresponding interface address. </p>
405
406<p> In most cases, using inet_interfaces in this way will not work,
407because as documented in the $inet_interfaces reference manual, the
408smtp(8) delivery agent will also use the specified interface address
409as the source address for outbound connections and will be unable to
410reach hosts on "the other side" of the firewall. The symptoms are that
411the firewall is unable to connect to hosts that are in fact up. See the
412inet_interfaces parameter documentation for suggested work-arounds.</p>
413
414<h2><a name="some_local">Delivering some but not all accounts
415locally</a></h2>
416
417<p> A drawback of sending mail as "user@example.com" (instead of
418"user@hostname.example.com") is that mail for "root" and other
419system accounts is also sent to the central mailhost.  In order to
420deliver such accounts locally, you can set up virtual aliases as
421follows:  </p>
422
423<blockquote>
424<pre>
4251 /etc/postfix/main.cf:
4262     virtual_alias_maps = hash:/etc/postfix/virtual
4273
4284 /etc/postfix/virtual:
4295     root     root@localhost
4306     . . .
431</pre>
432</blockquote>
433
434<p> Translation: </p>
435
436<ul>
437
438<li> <p> Line 5: As described in the virtual(5) manual page, the
439bare name "root" matches "root@site" when "site" is equal to
440$myorigin, when "site" is listed in $mydestination, or when it
441matches $inet_interfaces or $proxy_interfaces. </p>
442
443</ul>
444
445<p> Execute the command "<b>postmap /etc/postfix/virtual</b>" after
446editing the file. </p>
447
448<h2><a name="intranet">Running Postfix behind a firewall</a></h2>
449
450<p> The simplest way to set up Postfix on a host behind a firewalled
451network is to send all mail to a gateway host, and to let that mail
452host take care of internal and external forwarding. Examples of that
453are shown in the <a href="#local_network">local area network</a>
454section above. A more sophisticated approach is to send only external
455mail to the gateway host, and to send intranet mail directly. </p>
456
457<p> Note: this example requires Postfix version 2.0 and later. To find
458out what Postfix version you have, execute the command "<b>postconf
459mail_version</b>". </p>
460
461<p> The following example presents additional configuration. You
462need to combine this with basic configuration information as
463discussed the first half of this document. </p>
464
465<blockquote>
466<pre>
467 1 /etc/postfix/main.cf:
468 2     transport_maps = hash:/etc/postfix/transport
469 3     relayhost =
470 4     # Optional for a machine that isn't "always on"
471 5     #fallback_relay = [gateway.example.com]
472 6
473 7 /etc/postfix/transport:
474 8     # Internal delivery.
475 9     example.com      :
47610     .example.com     :
47711     # External delivery.
47812     *                smtp:[gateway.example.com]
479</pre>
480</blockquote>
481
482<p> Translation: </p>
483
484<ul>
485
486<li> <p> Lines 2, 7-12: Request that intranet mail is delivered
487directly, and that external mail is given to a gateway. Obviously,
488this example assumes that the organization uses DNS MX records
489internally.  The <tt>[]</tt> forces Postfix to do no MX lookup.
490</p>
491
492<li> <p> Line 3: IMPORTANT: do not specify a relayhost in main.cf.
493</p>
494
495<li> <p> Line 5: This prevents mail from being stuck in the queue
496when the machine is turned off.  Postfix tries to deliver mail
497directly, and gives undeliverable mail to a gateway.  </p>
498
499</ul>
500
501<p> Specify <b>dbm</b> instead of <b>hash</b> if your system uses
502<b>dbm</b> files instead of <b>db</b> files. To find out what lookup
503tables Postfix supports, use the command "<b>postconf -m</b>". </p>
504
505<p> Execute the command "<b>postmap /etc/postfix/transport</b>" whenever
506you edit the transport table. </p>
507
508<h2><a name="backup">Configuring Postfix as primary or backup MX host for a remote site</a></h2>
509
510<p> This section presents additional configuration. You need to
511combine this with basic configuration information as discussed the
512first half of this document. </p>
513
514<p> When your system is SECONDARY MX host for a remote site this
515is all you need: </p>
516
517<blockquote>
518<pre>
519 1 DNS:
520 2     the.backed-up.domain.tld        IN      MX 100 your.machine.tld.
521 3
522 4 /etc/postfix/main.cf:
523 5     relay_domains = . . . the.backed-up.domain.tld
524 6     smtpd_recipient_restrictions =
525 7         permit_mynetworks reject_unauth_destination
526 8
527 9     # You must specify your NAT/proxy external address.
52810     #proxy_interfaces = 1.2.3.4
52911
53012     relay_recipient_maps = hash:/etc/postfix/relay_recipients
53113
53214 /etc/postfix/relay_recipients:
53315     user1@the.backed-up.domain.tld   x
53416     user2@the.backed-up.domain.tld   x
53517      . . .
536</pre>
537</blockquote>
538
539<p> When your system is PRIMARY MX host for a remote site you
540need the above, plus: </p>
541
542<blockquote>
543<pre>
54418 /etc/postfix/main.cf:
54519     transport_maps = hash:/etc/postfix/transport
54620
54721 /etc/postfix/transport:
54822     the.backed-up.domain.tld       relay:[their.mail.host.tld]
549</pre>
550</blockquote>
551
552<p> Important notes:
553
554<ul>
555
556<li><p>Do not list the.backed-up.domain.tld in mydestination.</p>
557
558<li><p>Do not list the.backed-up.domain.tld in virtual_alias_domains.</p>
559
560<li><p>Do not list the.backed-up.domain.tld in virtual_mailbox_domains.</p>
561
562<li> <p> Lines 1-7: Forward mail from the Internet for
563"the.backed-up.domain.tld" to the primary MX host for that domain.
564</p>
565
566<li> <p> Line 10: This is a must if Postfix receives mail via a
567NAT relay or proxy that presents a different IP address to the
568world than the local machine. </p>
569
570<li> <p> Lines 12-16: Define the list of valid addresses in the
571"the.backed-up.domain.tld" domain.  This prevents your mail queue
572from filling up with undeliverable MAILER-DAEMON messages. If you
573can't maintain a list of valid recipients then you must specify
574"relay_recipient_maps =" (that is, an empty value), or you must
575specify an "@the.backed-up.domain.tld  x" wild-card in the
576relay_recipients table. </p>
577
578<li> <p> Line 22: The <tt>[]</tt> forces Postfix to do no MX lookup. </p>
579
580</ul>
581
582<p> Specify <b>dbm</b> instead of <b>hash</b> if your system uses
583<b>dbm</b> files instead of <b>db</b> files. To find out what lookup
584tables Postfix supports, use the command "<b>postconf -m</b>". </p>
585
586<p> Execute the command "<b>postmap /etc/postfix/transport</b>"
587whenever you change the transport table. </p>
588
589<p> NOTE for Postfix &lt; 2.2: Do not use the fallback_relay feature
590when relaying mail
591for a backup or primary MX domain. Mail would loop between the
592Postfix MX host and the fallback_relay host when the final destination
593is unavailable. </p>
594
595<ul>
596
597<li> In main.cf specify "<tt>relay_transport = relay</tt>",
598
599<li> In master.cf specify "<tt>-o fallback_relay =</tt>" at the
600end of the <tt>relay</tt> entry.
601
602<li> In transport maps, specify "<tt>relay:<i>nexthop...</i></tt>"
603as the right-hand side for backup or primary MX domain entries.
604
605</ul>
606
607<p> These are default settings in Postfix version 2.2 and later.
608</p>
609
610<h2><a name="dialup">Postfix on a dialup machine</a></h2>
611
612<p> This section applies to dialup connections that are down most
613of the time. For dialup connections that are up 24x7, see the <a
614href="#local_network">local area network</a> section above.  </p>
615
616<p> This section presents additional configuration. You need to
617combine this with basic configuration information as discussed the
618first half of this document. </p>
619
620<p> If you do not have your own hostname and IP address (usually
621with dialup, cable TV or DSL connections) then you should also
622study the section on "<a href="#fantasy">Postfix on hosts without
623a real Internet hostname</a>".  </p>
624
625<ul>
626
627<li> Route all outgoing mail to your network provider.
628
629<p> If your machine is disconnected most of the time, there isn't
630a lot of opportunity for Postfix to deliver mail to hard-to-reach
631corners of the Internet. It's better to give the mail to a machine
632that is connected all the time. In the example below, the <tt>[]</tt>
633prevents Postfix from trying to look up DNS MX records.  </p>
634
635<pre>
636/etc/postfix/main.cf:
637    relayhost = [smtprelay.someprovider.com]
638</pre>
639
640<li> <p><a name="spontaneous_smtp">Disable spontaneous SMTP mail
641delivery (if using on-demand dialup IP only).</a> </p>
642
643<p> Normally, Postfix attempts to deliver outbound mail at its convenience.
644If your machine uses on-demand dialup IP, this causes your system
645to place a telephone call whenever you submit new mail, and whenever
646Postfix retries to deliver delayed mail. To prevent such telephone
647calls from being placed, disable spontaneous SMTP mail deliveries. </p>
648
649<pre>
650/etc/postfix/main.cf:
651    defer_transports = smtp (Only for on-demand dialup IP hosts)
652</pre>
653
654<li> <p>Disable SMTP client DNS lookups (dialup LAN only).</p>
655
656<pre>
657/etc/postfix/main.cf:
658    disable_dns_lookups = yes (Only for on-demand dialup IP hosts)
659</pre>
660
661<li> Flush the mail queue whenever the Internet link is established.
662
663<p> Put the following command into your PPP or SLIP dialup scripts: </p>
664
665<pre>
666/usr/sbin/sendmail -q (whenever the Internet link is up)
667</pre>
668
669<p> The exact location of the Postfix sendmail command is system-specific.
670Use the command "<b>postconf sendmail_path</b>" to find out where the
671Postfix sendmail command is located on your machine. </p>
672
673<p> In order to find out if the mail queue is flushed, use something
674like: </p>
675
676<pre>
677#!/bin/sh
678
679# Start mail deliveries.
680/usr/sbin/sendmail -q
681
682# Allow deliveries to start.
683sleep 10
684
685# Loop until all messages have been tried at least once.
686while mailq | grep '^[^ ]*\*' &gt;/dev/null
687do
688    sleep 10
689done
690</pre>
691
692<p> If you have disabled <a href="#spontaneous_smtp">spontaneous
693SMTP mail delivery</a>, you also need to run the "<b>sendmail -q</b>"
694command every now and then while the dialup link is up, so that
695newly-posted mail is flushed from the queue. </p>
696
697</ul>
698
699<h2><a name="fantasy">Postfix on hosts without a real Internet
700hostname</a></h2>
701
702<p> This section is for hosts that don't have their own Internet
703hostname.  Typically these are systems that get a dynamic IP address
704via DHCP or via dialup. Postfix will let you send and receive mail
705just fine between accounts on a machine with a fantasy name. However,
706you cannot use a fantasy hostname in your email address when sending
707mail into the Internet, because no-one would be able to reply to
708your mail. In fact, more and more sites refuse mail addresses with
709non-existent domain names. </p>
710
711<p> Note: the following information is Postfix version dependent.
712To find out what Postfix version you have, execute the command
713"<b>postconf mail_version</b>". </p>
714
715<h3>Solution 1: Postfix version 2.2 and later </h3>
716
717<p> Postfix 2.2 uses the generic(5) address mapping to replace
718local fantasy email addresses by valid Internet addresses.  This
719mapping happens ONLY when mail leaves the machine; not when you
720send mail between users on the same machine. </p>
721
722<p> The following example presents additional configuration. You
723need to combine this with basic configuration information as
724discussed the first half of this document. </p>
725
726<blockquote>
727<pre>
7281 /etc/postfix/main.cf:
7292     smtp_generic_maps = hash:/etc/postfix/generic
7303
7314 /etc/postfix/generic:
7325     his@localdomain.local             hisaccount@hisisp.example
7336     her@localdomain.local             heraccount@herisp.example
7347     @localdomain.local                hisaccount+local@hisisp.example
735</pre>
736</blockquote>
737
738<p> When mail is sent to a remote host via SMTP: </p>
739
740<ul>
741
742<li> <p> Line 5 replaces <i>his@localdomain.local</i> by his ISP
743mail address, </p>
744
745<li> <p> Line 6 replaces <i>her@localdomain.local</i> by her ISP
746mail address, and </p>
747
748<li> <p> Line 7 replaces other local addresses by his ISP account,
749with an address extension of +<i>local</i> (this example assumes
750that the ISP supports "+" style address extensions). </p>
751
752</ul>
753
754<p>Specify <b>dbm</b> instead of <b>hash</b> if your system uses
755<b>dbm</b> files instead of <b>db</b> files. To find out what lookup
756tables Postfix supports, use the command "<b>postconf -m</b>".  </p>
757
758<p> Execute the command "<b>postmap /etc/postfix/generic</b>"
759whenever you change the generic table. </p>
760
761<h3>Solution 2: Postfix version 2.1 and earlier </h3>
762
763<p> The solution with older Postfix systems is to use valid
764Internet addresses where possible, and to let Postfix map valid
765Internet addresses to local fantasy addresses. With this, you can
766send mail to the Internet and to local fantasy addresses, including
767mail to local fantasy addresses that don't have a valid Internet
768address of their own.</p>
769
770<p> The following example presents additional configuration. You
771need to combine this with basic configuration information as
772discussed the first half of this document. </p>
773
774<blockquote>
775<pre>
776 1 /etc/postfix/main.cf:
777 2     myhostname = hostname.localdomain
778 3     mydomain = localdomain
779 4
780 5     canonical_maps = hash:/etc/postfix/canonical
781 6
782 7     virtual_alias_maps = hash:/etc/postfix/virtual
783 8
784 9 /etc/postfix/canonical:
78510     your-login-name    your-account@your-isp.com
78611
78712 /etc/postfix/virtual:
78813     your-account@your-isp.com       your-login-name
789</pre>
790</blockquote>
791
792<p> Translation: </p>
793
794<ul>
795
796<li> <p> Lines 2-3: Substitute your fantasy hostname here. Do not
797use a domain name that is already in use by real organizations
798on the Internet. See RFC 2606 for examples of domain
799names that are guaranteed not to be owned by anyone. </p>
800
801<li> <p> Lines 5, 9, 10: This provides the mapping from
802"your-login-name@hostname.localdomain" to "your-account@your-isp.com".
803This part is required. </p>
804
805<li> <p> Lines 7, 12, 13: Deliver mail for "your-account@your-isp.com"
806locally, instead of sending it to the ISP. This part is not required
807but is convenient.
808
809</ul>
810
811<p>Specify <b>dbm</b> instead of <b>hash</b> if your system uses
812<b>dbm</b> files instead of <b>db</b> files. To find out what lookup
813tables Postfix supports, use the command "<b>postconf -m</b>".  </p>
814
815<p> Execute the command "<b>postmap /etc/postfix/canonical</b>"
816whenever you change the canonical table. </p>
817
818<p> Execute the command "<b>postmap /etc/postfix/virtual</b>"
819whenever you change the virtual table. </p>
820
821</body>
822
823</html>
824