autoupdate
[postfix-master.git] / postfix-master / STANDARD_CONFIGURATION_README.html
blob9e92837f83f97e0b3c01e7c15c8c915baf4b7c5d
1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
4 <html>
6 <head>
8 <title>Postfix Standard Configuration Examples</title>
10 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
12 </head>
14 <body>
16 <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix Standard Configuration Examples</h1>
18 <hr>
20 <h2>Purpose of this document</h2>
22 <p> This document presents a number of typical Postfix configurations.
23 This document should be reviewed after you have followed the basic
24 configuration steps as described in the <a href="BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README</a>
25 document. In particular, do not proceed here if you don't already
26 have Postfix working for local mail submission and for local mail
27 delivery. </p>
29 <p> The first part of this document presents standard configurations
30 that each solve one specific problem. </p>
32 <ul>
34 <li><a href="#stand_alone">Postfix on a stand-alone Internet host</a>
36 <li><a href="#null_client">Postfix on a null client</a>
38 <li><a href="#local_network">Postfix on a local network</a>
40 <li><a href="#firewall">Postfix email firewall/gateway</a>
42 </ul>
44 <p> The second part of this document presents additional configurations
45 for hosts in specific environments. </p>
47 <ul>
49 <li><a href="#some_local">Delivering some but not all accounts locally</a>
51 <li><a href="#intranet">Running Postfix behind a firewall</a>
53 <li><a href="#backup">Configuring Postfix as primary or backup MX host for a remote
54 site</a>
56 <li><a href="#dialup">Postfix on a dialup machine</a>
58 <li><a href="#fantasy">Postfix on hosts without a real
59 Internet hostname</a>
61 </ul>
63 <h2><a name="stand_alone">Postfix on a stand-alone Internet host</a></h2>
65 <p> Postfix should work out of the box without change on a stand-alone
66 machine that has direct Internet access. At least, that is how
67 Postfix installs when you download the Postfix source code via
68 <a href="http://www.postfix.org/">http://www.postfix.org/</a>. </p>
70 <p> You can use the command "<b>postconf -n</b>" to find out what
71 settings are overruled by your <a href="postconf.5.html">main.cf</a>. Besides a few pathname
72 settings, few parameters should be set on a stand-alone box, beyond
73 what is covered in the <a href="BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README</a> document: </p>
75 <blockquote>
76 <pre>
77 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
78 # Optional: send mail as user@domainname instead of user@hostname.
79 #<a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
81 # Optional: specify NAT/proxy external address.
82 #<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> = 1.2.3.4
84 # Alternative 1: don't relay mail from other hosts.
85 <a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = host
86 <a href="postconf.5.html#relay_domains">relay_domains</a> =
88 # Alternative 2: relay mail from local clients only.
89 # <a href="postconf.5.html#mynetworks">mynetworks</a> = 192.168.1.0/28
90 # <a href="postconf.5.html#relay_domains">relay_domains</a> =
91 </pre>
92 </blockquote>
94 <p> See also the section "<a href="#fantasy">Postfix on hosts without
95 a real Internet hostname</a>" if this is applicable to your configuration.
96 </p>
98 <h2><a name="null_client">Postfix on a null client</a></h2>
100 <p> A null client is a machine that can only send mail. It receives no
101 mail from the network, and it does not deliver any mail locally. A
102 null client typically uses POP, IMAP or NFS for mailbox access. </p>
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".
106 As usual, the examples show only parameters that are not left at
107 their default settings. </p>
109 <blockquote>
110 <pre>
111 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
112 2 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
113 3 <a href="postconf.5.html#relayhost">relayhost</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
114 4 <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = loopback-only
115 5 <a href="postconf.5.html#local_transport">local_transport</a> = <a href="error.8.html">error</a>:local delivery is disabled
117 7 /etc/postfix/<a href="master.5.html">master.cf</a>:
118 8 Comment out the local delivery agent entry
119 </pre>
120 </blockquote>
122 <p> Translation: </p>
124 <ul>
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
128 to send mail to "user@nullclient.example.com". </p>
130 <li> <p> Line 3: Forward all mail to the mail server that is
131 responsible for the "example.com" domain. This prevents mail from
132 getting stuck on the null client if it is turned off while some
133 remote destination is unreachable. </p>
135 <li> <p> Line 4: Do not accept mail from the network. </p>
137 <li> <p> Lines 5-8: Disable local mail delivery. All mail goes to
138 the mail server as specified in line 3. </p>
140 </ul>
142 <h2><a name="local_network">Postfix on a local network</a></h2>
144 <p> This section describes a local area network environment of one
145 main server and multiple other systems that send and receive email.
146 As usual we assume that the Internet domain name is "example.com".
147 All systems are configured to send mail as "user@example.com", and
148 all systems receive mail for "user@hostname.example.com". The main
149 server also receives mail for "user@example.com". We call this
150 machine by the name of mailhost.example.com. </p>
152 <p> A drawback of sending mail as "user@example.com" is that mail
153 for "root" and other system accounts is also sent to the central
154 mailhost. See the section "<a href="#some_local">Delivering some
155 but not all accounts locally</a>" below for possible solutions.
156 </p>
158 <p> As usual, the examples show only parameters that are not left
159 at their default settings. </p>
161 <p> First we present the non-mailhost configuration, because it is
162 the simpler one. This machine sends mail as "user@example.com" and
163 is final destination for "user@hostname.example.com". </p>
165 <blockquote>
166 <pre>
167 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
168 2 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
169 3 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 10.0.0.0/24
170 4 <a href="postconf.5.html#relay_domains">relay_domains</a> =
171 5 # Optional: forward all non-local mail to mailhost
172 6 #<a href="postconf.5.html#relayhost">relayhost</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
173 </pre>
174 </blockquote>
176 <p> Translation: </p>
178 <ul>
180 <li> <p> Line 2: Send mail as "user@example.com". </p>
182 <li> <p> Line 3: Specify the trusted networks. </p>
184 <li> <p> Line 4: This host does not relay mail from untrusted networks. </p>
186 <li> <p> Line 6: This is needed if no direct Internet access is
187 available. See also below, "<a href="#firewall">Postfix behind
188 a firewall</a>". </p>
190 </ul>
192 <p> Next we present the mailhost configuration. This machine sends
193 mail as "user@example.com" and is final destination for
194 "user@hostname.example.com" as well as "user@example.com". </p>
196 <blockquote>
197 <pre>
198 1 DNS:
199 2 example.com IN MX 10 mailhost.example.com.
201 4 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
202 5 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
203 6 <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost $<a href="postconf.5.html#mydomain">mydomain</a>
204 7 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 10.0.0.0/24
205 8 <a href="postconf.5.html#relay_domains">relay_domains</a> =
206 9 # Optional: forward all non-local mail to firewall
207 10 #<a href="postconf.5.html#relayhost">relayhost</a> = [firewall.example.com]
208 </pre>
209 </blockquote>
211 <p> Translation: </p>
213 <ul>
215 <li> <p> Line 2: Send mail for the domain "example.com" to the
216 machine mailhost.example.com. Remember to specify the "." at the
217 end of the line. </p>
219 <li> <p> Line 5: Send mail as "user@example.com". </p>
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
223 itself. </p>
225 <li> <p> Line 7: Specify the trusted networks. </p>
227 <li> <p> Line 8: This host does not relay mail from untrusted networks. </p>
229 <li> <p> Line 10: This is needed only when the mailhost has to
230 forward non-local mail via a mail server on a firewall. The
231 <tt>[]</tt> forces Postfix to do no MX record lookups. </p>
233 </ul>
235 <p> In an environment like this, users access their mailbox in one
236 or more of the following ways:
238 <ul>
240 <li> <p> Mailbox access via NFS or equivalent. </p>
242 <li> <p> Mailbox access via POP or IMAP. </p>
244 <li> <p> Mailbox on the user's preferred machine. </p>
246 </ul>
248 <p> In the latter case, each user has an alias on the mailhost that
249 forwards mail to her preferred machine: </p>
251 <blockquote>
252 <pre>
253 /etc/aliases:
254 joe: joe@joes.preferred.machine
255 jane: jane@janes.preferred.machine
256 </pre>
257 </blockquote>
259 <p> On some systems the alias database is not in /etc/aliases. To
260 find out the location for your system, execute the command "<b>postconf
261 <a href="postconf.5.html#alias_maps">alias_maps</a></b>". </p>
263 <p> Execute the command "<b>newaliases</b>" whenever you change
264 the aliases file. </p>
266 <h2><a name="firewall">Postfix email firewall/gateway</a></h2>
268 <p> The idea is to set up a Postfix email firewall/gateway that
269 forwards mail for "example.com" to an inside gateway machine but
270 rejects mail for "anything.example.com". There is only one problem:
271 with "<a href="postconf.5.html#relay_domains">relay_domains</a> = example.com", the firewall normally also
272 accepts mail for "anything.example.com". That would not be right.
273 </p>
275 <p> Note: this example requires Postfix version 2.0 and later. To find
276 out what Postfix version you have, execute the command "<b>postconf
277 <a href="postconf.5.html#mail_version">mail_version</a></b>". </p>
279 <p> The solution is presented in multiple parts. This first part
280 gets rid of local mail delivery on the firewall, making the firewall
281 harder to break. </p>
283 <blockquote>
284 <pre>
285 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
286 2 <a href="postconf.5.html#myorigin">myorigin</a> = example.com
287 3 <a href="postconf.5.html#mydestination">mydestination</a> =
288 4 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> =
289 5 <a href="postconf.5.html#local_transport">local_transport</a> = <a href="error.8.html">error</a>:local mail delivery is disabled
291 7 /etc/postfix/<a href="master.5.html">master.cf</a>:
292 8 Comment out the local delivery agent
293 </pre>
294 </blockquote>
296 <p> Translation: </p>
298 <ul>
300 <li> <p> Line 2: Send mail from this machine as "user@example.com",
301 so that no reason exists to send mail to "user@firewall.example.com".
302 </p>
304 <li> <p> Lines 3-8: Disable local mail delivery on the firewall
305 machine. </p>
307 </ul>
309 <p> For the sake of technical correctness the firewall must be able
310 to receive mail for postmaster@[firewall ip address]. Reportedly,
311 some things actually expect this ability to exist. The second part
312 of the solution therefore adds support for postmaster@[firewall ip
313 address], and as a bonus we do abuse@[firewall ip address] as well.
314 All the mail to these two accounts is forwarded to an inside address.
315 </p>
317 <blockquote>
318 <pre>
319 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
320 2 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
322 4 /etc/postfix/virtual:
323 5 postmaster postmaster@example.com
324 6 abuse abuse@example.com
325 </pre>
326 </blockquote>
328 <p> Translation: </p>
330 <ul>
332 <li> <p> Because <a href="postconf.5.html#mydestination">mydestination</a> is empty (see the previous example),
333 only address literals matching $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> or $<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>
334 are deemed local. So "localpart@[a.d.d.r]" can be matched as simply
335 "localpart" in <a href="canonical.5.html">canonical(5)</a> and <a href="virtual.5.html">virtual(5)</a>. This avoids the need to
336 specify firewall IP addresses into Postfix configuration files. </p>
338 </ul>
340 <p> The last part of the solution does the email forwarding, which
341 is the real purpose of the firewall email function. </p>
343 <blockquote>
344 <pre>
345 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
346 2 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 12.34.56.0/24
347 3 <a href="postconf.5.html#relay_domains">relay_domains</a> = example.com
348 4 <a href="postconf.5.html#parent_domain_matches_subdomains">parent_domain_matches_subdomains</a> =
349 5 <a href="postconf.5.html#debug_peer_list">debug_peer_list</a> smtpd_access_maps
350 6 <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
351 7 <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a> <a href="postconf.5.html#reject_unauth_destination">reject_unauth_destination</a>
353 9 <a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a> = hash:/etc/postfix/relay_recipients
354 10 <a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
356 12 /etc/postfix/relay_recipients:
357 13 user1@example.com x
358 14 user2@example.com x
359 15 . . .
361 17 /etc/postfix/transport:
362 18 example.com <a href="smtp.8.html">smtp</a>:[inside-gateway.example.com]
363 </pre>
364 </blockquote>
366 <p> Translation: </p>
368 <ul>
370 <li><p> Lines 1-7: Accept mail from local systems in $<a href="postconf.5.html#mynetworks">mynetworks</a>,
371 and accept mail from outside for "user@example.com" but not for
372 "user@anything.example.com". The magic is in lines 4-5. </p>
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
376 prevents the mail queue from filling up with undeliverable
377 MAILER-DAEMON messages. If you can't maintain a list of valid
378 recipients then you must specify "<a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a> =" (that
379 is, an empty value), or you must specify an "@example.com x"
380 wild-card in the relay_recipients table. </p>
382 <li> <p> Lines 10, 17-18: Route mail for "example.com" to the inside
383 gateway machine. The <tt>[]</tt> forces Postfix to do no MX lookup.
384 </p>
386 </ul>
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
390 tables Postfix supports, use the command "<b>postconf -m</b>". </p>
392 <p> Execute the command "<b>postmap /etc/postfix/relay_recipients</b>"
393 whenever you change the relay_recipients table. </p>
395 <p> Execute the command "<b>postmap /etc/postfix/transport</b>"
396 whenever you change the transport table. </p>
398 <p> In some installations, there may be separate instances of Postfix
399 processing inbound and outbound mail on a multi-homed firewall. The
400 inbound Postfix instance has an SMTP server listening on the external
401 firewall interface, and the outbound Postfix instance has an SMTP server
402 listening on the internal interface. In such a configuration is it is
403 tempting to configure $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> in each instance with just the
404 corresponding interface address. </p>
406 <p> In most cases, using <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> in this way will not work,
407 because as documented in the $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> reference manual, the
408 <a href="smtp.8.html">smtp(8)</a> delivery agent will also use the specified interface address
409 as the source address for outbound connections and will be unable to
410 reach hosts on "the other side" of the firewall. The symptoms are that
411 the firewall is unable to connect to hosts that are in fact up. See the
412 <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> parameter documentation for suggested work-arounds.</p>
414 <h2><a name="some_local">Delivering some but not all accounts
415 locally</a></h2>
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
419 system accounts is also sent to the central mailhost. In order to
420 deliver such accounts locally, you can set up virtual aliases as
421 follows: </p>
423 <blockquote>
424 <pre>
425 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
426 2 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
428 4 /etc/postfix/virtual:
429 5 root root@localhost
430 6 . . .
431 </pre>
432 </blockquote>
434 <p> Translation: </p>
436 <ul>
438 <li> <p> Line 5: As described in the <a href="virtual.5.html">virtual(5)</a> manual page, the
439 bare name "root" matches "root@site" when "site" is equal to
440 $<a href="postconf.5.html#myorigin">myorigin</a>, when "site" is listed in $<a href="postconf.5.html#mydestination">mydestination</a>, or when it
441 matches $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> or $<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>. </p>
443 </ul>
445 <p> Execute the command "<b>postmap /etc/postfix/virtual</b>" after
446 editing the file. </p>
448 <h2><a name="intranet">Running Postfix behind a firewall</a></h2>
450 <p> The simplest way to set up Postfix on a host behind a firewalled
451 network is to send all mail to a gateway host, and to let that mail
452 host take care of internal and external forwarding. Examples of that
453 are shown in the <a href="#local_network">local area network</a>
454 section above. A more sophisticated approach is to send only external
455 mail to the gateway host, and to send intranet mail directly. </p>
457 <p> Note: this example requires Postfix version 2.0 and later. To find
458 out what Postfix version you have, execute the command "<b>postconf
459 <a href="postconf.5.html#mail_version">mail_version</a></b>". </p>
461 <p> The following example presents additional configuration. You
462 need to combine this with basic configuration information as
463 discussed the first half of this document. </p>
465 <blockquote>
466 <pre>
467 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
468 2 <a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
469 3 <a href="postconf.5.html#relayhost">relayhost</a> =
470 4 # Optional for a machine that isn't "always on"
471 5 #<a href="postconf.5.html#fallback_relay">fallback_relay</a> = [gateway.example.com]
473 7 /etc/postfix/transport:
474 8 # Internal delivery.
475 9 example.com :
476 10 .example.com :
477 11 # External delivery.
478 12 * <a href="smtp.8.html">smtp</a>:[gateway.example.com]
479 </pre>
480 </blockquote>
482 <p> Translation: </p>
484 <ul>
486 <li> <p> Lines 2, 7-12: Request that intranet mail is delivered
487 directly, and that external mail is given to a gateway. Obviously,
488 this example assumes that the organization uses DNS MX records
489 internally. The <tt>[]</tt> forces Postfix to do no MX lookup.
490 </p>
492 <li> <p> Line 3: IMPORTANT: do not specify a <a href="postconf.5.html#relayhost">relayhost</a> in <a href="postconf.5.html">main.cf</a>.
493 </p>
495 <li> <p> Line 5: This prevents mail from being stuck in the queue
496 when the machine is turned off. Postfix tries to deliver mail
497 directly, and gives undeliverable mail to a gateway. </p>
499 </ul>
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
503 tables Postfix supports, use the command "<b>postconf -m</b>". </p>
505 <p> Execute the command "<b>postmap /etc/postfix/transport</b>" whenever
506 you edit the transport table. </p>
508 <h2><a name="backup">Configuring Postfix as primary or backup MX host for a remote site</a></h2>
510 <p> This section presents additional configuration. You need to
511 combine this with basic configuration information as discussed the
512 first half of this document. </p>
514 <p> When your system is SECONDARY MX host for a remote site this
515 is all you need: </p>
517 <blockquote>
518 <pre>
519 1 DNS:
520 2 the.backed-up.domain.tld IN MX 100 your.machine.tld.
522 4 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
523 5 <a href="postconf.5.html#relay_domains">relay_domains</a> = . . . the.backed-up.domain.tld
524 6 <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
525 7 <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a> <a href="postconf.5.html#reject_unauth_destination">reject_unauth_destination</a>
527 9 # You must specify your NAT/proxy external address.
528 10 #<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> = 1.2.3.4
530 12 <a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a> = hash:/etc/postfix/relay_recipients
532 14 /etc/postfix/relay_recipients:
533 15 user1@the.backed-up.domain.tld x
534 16 user2@the.backed-up.domain.tld x
535 17 . . .
536 </pre>
537 </blockquote>
539 <p> When your system is PRIMARY MX host for a remote site you
540 need the above, plus: </p>
542 <blockquote>
543 <pre>
544 18 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
545 19 <a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
547 21 /etc/postfix/transport:
548 22 the.backed-up.domain.tld relay:[their.mail.host.tld]
549 </pre>
550 </blockquote>
552 <p> Important notes:
554 <ul>
556 <li><p>Do not list the.backed-up.domain.tld in <a href="postconf.5.html#mydestination">mydestination</a>.</p>
558 <li><p>Do not list the.backed-up.domain.tld in <a href="postconf.5.html#virtual_alias_domains">virtual_alias_domains</a>.</p>
560 <li><p>Do not list the.backed-up.domain.tld in <a href="postconf.5.html#virtual_mailbox_domains">virtual_mailbox_domains</a>.</p>
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>
566 <li> <p> Line 10: This is a must if Postfix receives mail via a
567 NAT relay or proxy that presents a different IP address to the
568 world than the local machine. </p>
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
572 from filling up with undeliverable MAILER-DAEMON messages. If you
573 can't maintain a list of valid recipients then you must specify
574 "<a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a> =" (that is, an empty value), or you must
575 specify an "@the.backed-up.domain.tld x" wild-card in the
576 relay_recipients table. </p>
578 <li> <p> Line 22: The <tt>[]</tt> forces Postfix to do no MX lookup. </p>
580 </ul>
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
584 tables Postfix supports, use the command "<b>postconf -m</b>". </p>
586 <p> Execute the command "<b>postmap /etc/postfix/transport</b>"
587 whenever you change the transport table. </p>
589 <p> NOTE for Postfix &lt; 2.2: Do not use the <a href="postconf.5.html#fallback_relay">fallback_relay</a> feature
590 when relaying mail
591 for a backup or primary MX domain. Mail would loop between the
592 Postfix MX host and the <a href="postconf.5.html#fallback_relay">fallback_relay</a> host when the final destination
593 is unavailable. </p>
595 <ul>
597 <li> In <a href="postconf.5.html">main.cf</a> specify "<tt><a href="postconf.5.html#relay_transport">relay_transport</a> = relay</tt>",
599 <li> In <a href="master.5.html">master.cf</a> specify "<tt>-o <a href="postconf.5.html#fallback_relay">fallback_relay</a> =</tt>" at the
600 end of the <tt>relay</tt> entry.
602 <li> In transport maps, specify "<tt>relay:<i>nexthop...</i></tt>"
603 as the right-hand side for backup or primary MX domain entries.
605 </ul>
607 <p> These are default settings in Postfix version 2.2 and later.
608 </p>
610 <h2><a name="dialup">Postfix on a dialup machine</a></h2>
612 <p> This section applies to dialup connections that are down most
613 of the time. For dialup connections that are up 24x7, see the <a
614 href="#local_network">local area network</a> section above. </p>
616 <p> This section presents additional configuration. You need to
617 combine this with basic configuration information as discussed the
618 first half of this document. </p>
620 <p> If you do not have your own hostname and IP address (usually
621 with dialup, cable TV or DSL connections) then you should also
622 study the section on "<a href="#fantasy">Postfix on hosts without
623 a real Internet hostname</a>". </p>
625 <ul>
627 <li> Route all outgoing mail to your network provider.
629 <p> If your machine is disconnected most of the time, there isn't
630 a lot of opportunity for Postfix to deliver mail to hard-to-reach
631 corners of the Internet. It's better to give the mail to a machine
632 that is connected all the time. In the example below, the <tt>[]</tt>
633 prevents Postfix from trying to look up DNS MX records. </p>
635 <pre>
636 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
637 <a href="postconf.5.html#relayhost">relayhost</a> = [smtprelay.someprovider.com]
638 </pre>
640 <li> <p><a name="spontaneous_smtp">Disable spontaneous SMTP mail
641 delivery (if using on-demand dialup IP only).</a> </p>
643 <p> Normally, Postfix attempts to deliver outbound mail at its convenience.
644 If your machine uses on-demand dialup IP, this causes your system
645 to place a telephone call whenever you submit new mail, and whenever
646 Postfix retries to deliver delayed mail. To prevent such telephone
647 calls from being placed, disable spontaneous SMTP mail deliveries. </p>
649 <pre>
650 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
651 <a href="postconf.5.html#defer_transports">defer_transports</a> = smtp (Only for on-demand dialup IP hosts)
652 </pre>
654 <li> <p>Disable SMTP client DNS lookups (dialup LAN only).</p>
656 <pre>
657 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
658 <a href="postconf.5.html#disable_dns_lookups">disable_dns_lookups</a> = yes (Only for on-demand dialup IP hosts)
659 </pre>
661 <li> Flush the mail queue whenever the Internet link is established.
663 <p> Put the following command into your PPP or SLIP dialup scripts: </p>
665 <pre>
666 /usr/sbin/sendmail -q (whenever the Internet link is up)
667 </pre>
669 <p> The exact location of the Postfix sendmail command is system-specific.
670 Use the command "<b>postconf <a href="postconf.5.html#sendmail_path">sendmail_path</a></b>" to find out where the
671 Postfix sendmail command is located on your machine. </p>
673 <p> In order to find out if the mail queue is flushed, use something
674 like: </p>
676 <pre>
677 #!/bin/sh
679 # Start mail deliveries.
680 /usr/sbin/sendmail -q
682 # Allow deliveries to start.
683 sleep 10
685 # Loop until all messages have been tried at least once.
686 while mailq | grep '^[^ ]*\*' &gt;/dev/null
688 sleep 10
689 done
690 </pre>
692 <p> If you have disabled <a href="#spontaneous_smtp">spontaneous
693 SMTP mail delivery</a>, you also need to run the "<b>sendmail -q</b>"
694 command every now and then while the dialup link is up, so that
695 newly-posted mail is flushed from the queue. </p>
697 </ul>
699 <h2><a name="fantasy">Postfix on hosts without a real Internet
700 hostname</a></h2>
702 <p> This section is for hosts that don't have their own Internet
703 hostname. Typically these are systems that get a dynamic IP address
704 via DHCP or via dialup. Postfix will let you send and receive mail
705 just fine between accounts on a machine with a fantasy name. However,
706 you cannot use a fantasy hostname in your email address when sending
707 mail into the Internet, because no-one would be able to reply to
708 your mail. In fact, more and more sites refuse mail addresses with
709 non-existent domain names. </p>
711 <p> Note: the following information is Postfix version dependent.
712 To find out what Postfix version you have, execute the command
713 "<b>postconf <a href="postconf.5.html#mail_version">mail_version</a></b>". </p>
715 <h3>Solution 1: Postfix version 2.2 and later </h3>
717 <p> Postfix 2.2 uses the <a href="generic.5.html">generic(5)</a> address mapping to replace
718 local fantasy email addresses by valid Internet addresses. This
719 mapping happens ONLY when mail leaves the machine; not when you
720 send mail between users on the same machine. </p>
722 <p> The following example presents additional configuration. You
723 need to combine this with basic configuration information as
724 discussed the first half of this document. </p>
726 <blockquote>
727 <pre>
728 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
729 2 <a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a> = hash:/etc/postfix/generic
731 4 /etc/postfix/generic:
732 5 his@localdomain.local hisaccount@hisisp.example
733 6 her@localdomain.local heraccount@herisp.example
734 7 @localdomain.local hisaccount+local@hisisp.example
735 </pre>
736 </blockquote>
738 <p> When mail is sent to a remote host via SMTP: </p>
740 <ul>
742 <li> <p> Line 5 replaces <i>his@localdomain.local</i> by his ISP
743 mail address, </p>
745 <li> <p> Line 6 replaces <i>her@localdomain.local</i> by her ISP
746 mail address, and </p>
748 <li> <p> Line 7 replaces other local addresses by his ISP account,
749 with an address extension of +<i>local</i> (this example assumes
750 that the ISP supports "+" style address extensions). </p>
752 </ul>
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
756 tables Postfix supports, use the command "<b>postconf -m</b>". </p>
758 <p> Execute the command "<b>postmap /etc/postfix/generic</b>"
759 whenever you change the generic table. </p>
761 <h3>Solution 2: Postfix version 2.1 and earlier </h3>
763 <p> The solution with older Postfix systems is to use valid
764 Internet addresses where possible, and to let Postfix map valid
765 Internet addresses to local fantasy addresses. With this, you can
766 send mail to the Internet and to local fantasy addresses, including
767 mail to local fantasy addresses that don't have a valid Internet
768 address of their own.</p>
770 <p> The following example presents additional configuration. You
771 need to combine this with basic configuration information as
772 discussed the first half of this document. </p>
774 <blockquote>
775 <pre>
776 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
777 2 <a href="postconf.5.html#myhostname">myhostname</a> = hostname.localdomain
778 3 <a href="postconf.5.html#mydomain">mydomain</a> = localdomain
780 5 <a href="postconf.5.html#canonical_maps">canonical_maps</a> = hash:/etc/postfix/canonical
782 7 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
784 9 /etc/postfix/canonical:
785 10 your-login-name your-account@your-isp.com
787 12 /etc/postfix/virtual:
788 13 your-account@your-isp.com your-login-name
789 </pre>
790 </blockquote>
792 <p> Translation: </p>
794 <ul>
796 <li> <p> Lines 2-3: Substitute your fantasy hostname here. Do not
797 use a domain name that is already in use by real organizations
798 on the Internet. See <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a> for examples of domain
799 names that are guaranteed not to be owned by anyone. </p>
801 <li> <p> Lines 5, 9, 10: This provides the mapping from
802 "your-login-name@hostname.localdomain" to "your-account@your-isp.com".
803 This part is required. </p>
805 <li> <p> Lines 7, 12, 13: Deliver mail for "your-account@your-isp.com"
806 locally, instead of sending it to the ISP. This part is not required
807 but is convenient.
809 </ul>
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
813 tables Postfix supports, use the command "<b>postconf -m</b>". </p>
815 <p> Execute the command "<b>postmap /etc/postfix/canonical</b>"
816 whenever you change the canonical table. </p>
818 <p> Execute the command "<b>postmap /etc/postfix/virtual</b>"
819 whenever you change the virtual table. </p>
821 </body>
823 </html>