Postfix to use a third party SMTP server

3 Mar

This instructs postfix to use a third party SMTP server. It’s useful when you want to relay e-mail from an internal server which uses a dynamic IP address.

Ensure postfix is installed, and let’s have all e-mail sent to root relay to an external e-mail address:

nano /etc/postfix/sender_canonical
root     youremail@provider.tld

Postfix requires the modifications to be hashed:

postmap hash:/etc/postfix/sender_canonical
postconf -e "sender_canonical_maps=hash:/etc/postfix/sender_canonical"

Now let’s instruct postfix to use third party SMTP to route e-mail:

nano /etc/postfix/main.cf
relayhost = yoursmtp.provider.tld
service postfix restart

Finally update system aliases:

nano /etc/aliases
root:   matthew@kinderwater.ca
newaliases

Leave a Reply

Your email address will not be published. Required fields are marked *