Zimbra Email Server Intergration with SendGrid
Category : How-to
Zimbra Email Server is an install anywhere, full featured email server solution. I know that sounds like a sales pitch, but it really is one of the better all-in-one on premise email solutions. It’s scalable, deployable on several platforms and hosts a comprehensive web mail service for users to manage email from a browser.
As good as Zimbra is, it can’t (or can any email server) make up for a bad network set up. For example, many email servers, such as Hotmail, will simply bounce emails coming from dynamic IP addresses – bad news if you run Zimbra from home. You’ll also need to set up SPF records to validate email being sent from your server against your domain.
To simplify the sending part of your email server, you can use a service such as SendGrid. What SendGrid do is act as the middle man between your email server and the recipient. Your email server will forward sent emails to SendGrid and SendGrid will deliver the email to the recipient with all the required configuration taken care of to keep your sent email out of the SMAP bin.
Before we get going, we’ll need an account on SendGrid. The free account should be enough to get you started.
To set up Zimbra, we need to configure the MTA to relay all email to our SendGrid address for SendGrid to relay the email to the recipient. Follow the below steps to set up Zimbra as a relay server.
Open the below file in your favourite text editor:
And add, all on one line, smtp.sendgrid.net along with your username and password in the following format username:password. For example:
Next, run the following commands in order to configure Zimbra’s MTA to use your above SMTP credentials to relay all outgoing email.
postmap /opt/zimbra/conf/relay_password postmap -q smtp.sendgrid.net /opt/zimbra/conf/relay_password zmprov ms `zmhostname` zimbraMtaSmtpSaslPasswordMaps lmdb:/opt/zimbra/conf/relay_password zmprov ms `zmhostname` zimbraMtaSmtpSaslAuthEnable yes zmprov ms `zmhostname` zimbraMtaSmtpCnameOverridesServername no zmprov ms `zmhostname` zimbraMtaSmtpTlsSecurityLevel may zmprov ms `zmhostname` zimbraMtaSmtpSaslSecurityOptions noanonymous zmprov ms `zmhostname` zimbraMtaRelayHost smtp.sendgrid.net:587
Zimbra will reload the config after 2 minutes (by default) and your new changes will take affect.
Send a test email and you should see that all new outgoing email is sent via SendGrid.