The simplest way to set up Postfix on a host behind a firewalled
network is to send all mail to a gateway host, and to let that mail
host take care of internal and external forwarding. Examples of that
are shown in the
local area network
section above. A more sophisticated approach is to send only external
mail to the gateway host, and to send intranet mail directly.
That's what Wietse does at work.
Note: this example requires Postfix version 2.0 and later. To find
out what Postfix version you have, execute the command "postconf
mail_version".
The following example presents additional configuration. You
need to combine this with basic configuration information as
discussed the first half of this document.
1 /etc/postfix/
main.cf:
2
transport_maps = hash:/etc/postfix/transport
3
relayhost =
4 # Optional for a machine that isn't "always on"
5 #
fallback_relay = [gateway.example.com]
6
7 /etc/postfix/transport:
8 # Internal delivery.
9 example.com :
10 .example.com :
11 # External delivery.
12 *
smtp:[gateway.example.com]
Translation:
-
Lines 2, 7-12: Request that intranet mail is delivered
directly, and that external mail is given to a gateway. Obviously,
this example assumes that the organization uses DNS MX records
internally. The [] forces Postfix to do no MX lookup.
-
Line 3: IMPORTANT: do not specify a
relayhost in
main.cf.
-
Line 5: This prevents mail from being stuck in the queue
when the machine is turned off. Postfix tries to deliver mail
directly, and gives undeliverable mail to a gateway.
Specify dbm instead of hash if your system uses
dbm files instead of db files. To find out what lookup
tables Postfix supports, use the command "postconf -m".
Execute the command "postmap /etc/postfix/transport" whenever
you edit the transport table.