Relay outbound email through SendGrid
A common approach for improving email delivery success rates is to send email through a transactional email delivery service such as SendGrid.
To configure your server’s mail transfer agent, Postfix, to relay all email through SendGrid, perform the steps below.
First, SSH in to your server as root
and run the following command
to install the libraries required for Postfix to authenticate to SendGrid
using your SendGrid credentials:
sudo apt-get install libsasl2-modules
Next, edit the file /etc/postfix/main.cf
and add the following lines:
smtp_sasl_auth_enable = yessmtp_sasl_password_maps = static:yourSendGridUsername:yourSendGridPasswordsmtp_sasl_security_options = noanonymoussmtp_tls_security_level = encryptheader_size_limit = 4096000relayhost = [smtp.sendgrid.net]:587
Finally, save the file and restart Postfix:
sudo service postfix restart