• Configure Postfix to Send Mail Using an External SMTP Relay

Configuring the Postfix Relay Server: Below you will configure the /etc/postfix/main.cf file to use the external SMTP server.

Open the /etc/postfix/main.cf file with your favorite text editor:

vi /etc/postfix/main.cf

Update the relayhost parameter to show your external SMTP relay host. Important: If you specified a non-default TCP port in the sasl_passwd file, then you must use the same port when configuring the relayhost parameter.

/etc/postfix/main.cf

    # specify SMTP relay host 
    relayhost = [mail.isp.example]:587

Check the appropriate Google Apps, Mandrill, or SendGrid section for the details to enter here.

At the end of the file, add the following parameters to enable authentication:

/etc/postfix/main.cf

    # enable SASL authentication 
    smtp_sasl_auth_enable = yes
    # disallow methods that allow anonymous authentication. 
    smtp_sasl_security_options = noanonymous
    # where to find sasl_passwd
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    # Enable STARTTLS encryption 
    smtp_use_tls = yes
    # where to find CA certificates
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Save your changes.

Restart Postfix:

sudo service postfix restart

This article was last modified: Feb. 22, 2016, 1:27 p.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top