Sending an outgoing email through a 3rd party SMTP relay service is a quick and easy alternative to setting up a full-fledged local email server.

Open /etc/postfix/ and add the remote mail server hostname to end of the file:

relayhost = []

If the remote system uses a different port number, please specify the port number:

relayhost = []:587

In some situations, for redundancy, you may want to configure the relay via two or more remote SMTP server. In such instances, you may configure the following;

relayhost = []
fallback_relay = []

This gives us redundancy in a way so that if one of the SMTP relays is down, we can send emails out via the second one.

If you need to use login username and password you can add this:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps =
smtp_sasl_security_options = noanonymous

Now, open /etc/postfix/mynetworks and the public IP of the remote mail server. For example,

This will let the mail server know exactly which networks are allowed to relay mail. This is a very important step

Restart postfix:

service restart postfix

* Don't forget that remote mail servers need to have a valid SPF record and to be properly configured.