← ServerPilot Docs

How to Integrate SendGrid with Postfix

ServerPilot enables Postfix so your apps can send mail from your server; however, ensuring 100% email delivery yourself can be tricky.

So email coming from your server is not marked as spam, you can sign up for SendGrid and integrate its mail delivery service with Postfix.

Careful! This is an advanced tutorial!

Unless you are absolutely sure about what you're doing, you should stop now.

Make sure to create a snapshot or a backup of your server before making any customizations.

First, SSH in to your server as root and run the following command:

sudo apt-get install libsasl2-modules

Now, open your Postfix config file, located at /etc/postfix/main.cf and add the following lines:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:yourSendGridUsername:yourSendGridPassword
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

Save the file and restart Postfix with this command:

sudo service postfix restart
Last updated: February 7, 2017

Launch your first site in 5 minutes