Zimbra & Sendgrid SMTP Setup

All the operations need to be done as a Zimbra user.

1. Point a domain to an SMTP server

zmprov ms mail.example.com zimbraMtaRelayHost smtp.sendgrid.net

2. Add SMTP authentication for smtp relay server

echo smtp.sendgrid.net username:password > /opt/zimbra/conf/relay_password

3. Export it to postfix

postmap hash:/opt/zimbra/conf/relay_password

4. Check the credentials are saved properly

postmap -q smtp.sendgrid.net /opt/zimbra/conf/relay_password

5. Setup SASL to use smtp relay authentication

postconf -e smtp_sasl_password_maps=hash:/opt/zimbra/conf/relay_password

6. Enable SASL authentication

postconf -e smtp_sasl_auth_enable=yes

7. Use domain names instead of sendgrid domain name

postconf -e smtp_cname_overrides_servername=no

8. Use TLS for SMTP

postconf -e smtp_use_tls=yes

9. Enable plaintext authentication (Sengrid supports only plaintext authentication)

postconf -e smtp_sasl_security_options=noanonymous

10. Restart postfix

postfix reload

All done, we can check the same by looking at the headers on mail which are sent from the configured domain.

Leave a Reply

Your email address will not be published. Required fields are marked *