Linux Commands and Scripts

How To Configure Remote SMTP Server as relay

In this article, we will configure remote SMTP server as relay on CentOS 7.

If you want to configure 3rd party SMTP relay service, this article will help you. 3rd party SMTP relay service can be quick and easy alternative to setting up a full-fledged local email server.

1. Open file

# vi /etc/postfix/

2. Add a remote mail server hostname

relayhost = []

In case, SMTP server uses a different port, you need to mention it like shown below

relayhost = []:587

If you want to use multiple SMTP server for redundancy, you may configure like shown below

relayhost = [] fallback_relay = []

This will gives you flexibility, if one SMTP relay is down, you can still send emails using second SMTP server.

In case, the SMTP server need to be configured with username and password, you can use following values:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps =
smtp_sasl_security_options = noanonymous

3. Open /etc/postfix/mynetworks

# vi /etc/postfix/mynetworks

And add external SMTP server’s IP address like shown below:

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

4. Restart postfix service

# systemctl restart postfix

That’s it. Now verify it by sending an email.

In this article, we have seen how our support engineers configure remote SMTP server as relay on CentOS 7.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles