This is used to set up Sendgrid in Plesk for Azure email functionality.
- Set up a sendgrid account and set up the first email:
- Ssh to the Azure server and make the following modifications:
Find your Postfix config file, typically /etc/postfix/main.cf, and add the following:
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 = [smtp.sendgrid.net]:587
Now you need to specify your credentials (optionally, use apikey as username and an API Key as password) in the separate file /etc/postfix/sasl_passwd (you’ll likely need to create it):
Next, 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
Finally, restart Postfix:
$ sudo systemctl restart postfix
Send your email and then verify in sendgrid.
If you are getting no mechanism available error messages it generally indicates that you are missing some SASL authentication libraries.
Install the missing module dependency using apt-get (i.e., Debian, Ubuntu):
$ apt-get install libsasl2-modules
Or using a yum (i.e., RedHat, Fedora, CentOS):
$ yum install cyrus-sasl-plain
If port 587 is not working for you please try 2525 in your postfix config. You may also need to edit /etc/postfix/master.cf to remove # from
#tlsmgr unix - - n 1000? 1 tlsmgr
Other integrations with MTA’a – https://sendgrid.com/docs/Integrate/Mail_Servers/postfix.html