This section describes a local area network environment of one
main server and multiple other systems that send and receive email.
As usual we assume that the Internet domain name is "example.com".
All systems are configured to send mail as "user@example.com", and
all systems receive mail for "user@hostname.example.com". The main
server also receives mail for "user@example.com". We call this
machine by the name of mailhost.example.com.
A drawback of sending mail as "user@example.com" is that mail
for "root" and other system accounts is also sent to the central
mailhost. See the section "
Delivering some
but not all accounts locally" below for possible solutions.
As usual, the examples show only parameters that are not left
at their default settings.
First we present the non-mailhost configuration, because it is
the simpler one. This machine sends mail as "user@example.com" and
is final destination for "user@hostname.example.com".
1 /etc/postfix/
main.cf:
2
myorigin = $
mydomain
3
mynetworks = 127.0.0.0/8 10.0.0.0/24
4
relay_domains =
5 # Optional: forward all non-local mail to mailhost
6 #
relayhost = $
mydomain
Translation:
-
Line 2: Send mail as "user@example.com".
-
Line 3: Specify the trusted networks.
-
Line 4: This host does not relay mail from untrusted networks.
-
Line 6: This is needed if no direct Internet access is
available. See also below, "
Postfix behind
a firewall".
Next we present the mailhost configuration. This machine sends
mail as "user@example.com" and is final destination for
"user@hostname.example.com" as well as "user@example.com".
1 DNS:
2 example.com IN MX 10 mailhost.example.com.
3
4 /etc/postfix/
main.cf:
5
myorigin = $
mydomain
6
mydestination = $
myhostname localhost.$
mydomain localhost $
mydomain
7
mynetworks = 127.0.0.0/8 10.0.0.0/24
8
relay_domains =
9 # Optional: forward all non-local mail to firewall
10 #
relayhost = [firewall.example.com]
Translation:
-
Line 2: Send mail for the domain "example.com" to the
machine mailhost.example.com. Remember to specify the "." at the
end of the line.
-
Line 5: Send mail as "user@example.com".
-
Line 6: This host is the final mail destination for the
"example.com" domain, in addition to the names of the machine
itself.
-
Line 7: Specify the trusted networks.
-
Line 8: This host does not relay mail from untrusted networks.
-
Line 10: This is needed only when the mailhost has to
forward non-local mail via a mail server on a firewall. The
[] forces Postfix to do no MX record lookups.
In an environment like this, users access their mailbox in one
or more of the following ways:
-
Mailbox access via NFS or equivalent.
-
Mailbox access via POP or IMAP.
-
Mailbox on the user's preferred machine.
In the latter case, each user has an alias on the mailhost that
forwards mail to her preferred machine:
/etc/aliases:
joe: joe@joes.preferred.machine
jane: jane@janes.preferred.machine
On some systems the alias database is not in /etc/aliases. To
find out the location for your system, execute the command "postconf
alias_maps".
Execute the command "newaliases" whenever you change
the aliases file.