Configure Postfix Relay

Configure Simple Relay

To configure the Linux server’s postfix software to relay mail to your SMTP server, open the postfix configuration file for editing:

vim /etc/postfix/

If your SMTP server allows relay without authentication, simply add the appropriate relayhost entry:

relayhost =

Restart the postfix service to apply the settings change:

service postfix reload

Configure Relay with Authentication

Open the postfix configuration file for editing:

vim /etc/postfix/

If your SMTP server requires authentication (SMTP AUTH) and a secure connection (TLS), use the following procedure (which has been tested with Google Apps and Office365):

relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_security_level = may

Create a file where the credentials for SMTP AUTH will be stored:

vim /etc/postfix/sasl_passwd

Enter the credentials:


Apply the settings:

postmap /etc/postfix/sasl_passwd
chmod 644 /etc/postfix/sasl_passwd
service postfix reload


Can’t Send Mail from Root

If your mail server requires that mail be sent from a valid address, you may have problems sending mail from the root account, which is required for backup reports and other purposes. In this case, create a mapping for the root user to a valid email address.

Add the following line to /etc/postfix/

smtp_generic_maps = hash:/etc/postfix/generic

Add the required email address alias to /etc/postfix/generic:


Create the hash file and reload postfix:

postmap /etc/postfix/generic
service postfix reload

Vendor-Specific Notes

If you are having trouble sending outbound email with your mail server, you may refer to the hints below, or you may use a mail relay service like SendGrid.


Please follow these instructions to configure postfix to relay via Google Apps or Gmail.

Microsoft Office365

Please follow these instructions to configure Office365 and postfix to work with your Eclipse server.


If you are having trouble with email relay using your mail server, we recommend using SendGrid.