Relaying Mail and MX backup
First make sure the server is not an open relay, it would allow anyone sending mail through the server.
smtpd_relay_restrictions =
permit_mynetworks,
reject_unauth_destination
The “reject_unauth_destination” is the vital part.
The following tells postfix what mail to relay and where.
relay_domains = mail.example.com
transport_maps = hash:/etc/postfix/transport
relay_recipient_maps = hash:/etc/postfix/relay_recipients
In the “transport” file set up each domain and where it should be relayed. This file is also used for the “relay_domains” parameter that will only read the first column.
# /etc/postfix/transport
# run "postmap /etc/postfix/transport" after each edit
example.com smtp:mail.example.com:25
List all recipients that should be relayed in the “relay_recipients” file. Easiest is to simply list a domain and accept all addresses for it.
By instead specifying each real address the mail relay server can discard mail to non existing users directly. Then the list will however need to be updated when you add/remove addresses/mailboxes on your mail server.
# /etc/postfix/relay_recipients
# run "postmap /etc/postfix/relay_recipients" after each edit
@example.com OK
info@example.com OK
joe@example.com OK
Some other good settings include the maximum message size that I set to 25 MB, same as Gmail. The queue lifetime decides how long the server will keep trying to send mail. I set this to 10 days, this gives ample time to get a mail server up and running again.
message_size_limit = 25600000
maximal_queue_lifetime = 10d
See
Postfix Configuration Parameters for a detailed explanation of all the parameters.