How To Integrate SendGrid With Postfix

Step : 1

Edit the file /etc/postfix/

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = []:587

Save and close the file.

Step : 2

Edit the file /etc/postfix/sasl_passwd

[]:587 yourSendGridUsername:yourSendGridPassword

Add your sendgrid user name and password, you can use your API key.

Step : 3

Make sure the file has restricted read and write access only for root, and use the postmap command to update Postfix’s hashtables to use this new file:

sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

Step : 4

Finally restart the postfix

sudo systemctl restart postfix
sudo systemctl status postfix

Leave a Reply