Using PostSMTP with Mandrill and SendGrid
Make sure your message gets through, the only email plugin with a fallback option!
Alerts when there are issues
Get alerts to Slack or Email when there are issues but email still gets through.
WordPress can generate a lot of emails, letting you know you have a new subscriber or someone has completed an online form, to send logon codes, password reset requests and security alerts. If you run an eCommerce site it will be sending email order confirmations and even download links.
If we manage your WordPress server on one of our WordPress Care Plans we get security alerts and updates.
It is really important that these get through and don’t end up being blocked or in a spam or junk folder.
The default method for sending these emails is via the SMTP service that is installed on the server hosting your site. We come across two issues sending email this way, 1 there may not be an SMTP service installed, 2 messages will normally end up in the recipients spam or junk folder or may even be blocked completely.
To ensure that these emails get through you need to send your email from a correctly configured service though a correctly configured domain with SPF records.
Using the PostSMTP plugin with either the Mandrill service from MailChimp or the SendGrid service not only will every email get through but, should there be a problem you can quickly find what is going wrong.
The SendGrid service is the easiest of the 2 services to setup and with pricing starting at FREE it is also the cheapest. Once you have signed up you will need to setup an API key so the plugin can send email. The only other thing you will need to do is modify the SPF record for the domain, SendGrid does not require this setting, but if it is not set your email might get blocked.
Most domains will have an SPF record similar to that below:
v=spf1 include:spf.protection.outlook.com -all
We need to add “include:sendgrid.net” to the record so it should look similar to:
v=spf1 include:spf.protection.outlook.com include:sendgrid.net -all
Use the buttons below to sign up for your account and generate your API key. (NOTE: The API will only be shown once, so make sure you save it somewhere safe.)
Mandrill is a transactional email service for MailChimp users. To use it you will need a MailChimp account. Once you have signed up for a MailChimp account you can add the Mandrill service. The service has no free option and prices start at $20.00 per block of 25,000 emails. Sendgrid charges $14.95 for the same amount.
After signing up for MailChimp and adding Mandrill you will need to add your domain. Once the domain is added you will need to:
- Verify ownership – this is a case of sending an email to an account on the domain and click the verify link.
- Add a DKIM TXT record to the DNS for the domain.
- Modify your SPF record.
The dashboard will guide you through exactly what records to add, you simply need to add them. After adding and verifying the records are correct you now need to generate an API for PostSMTP to use.
To generate an API simply click SMTP & API info in the dashboard and click + New API Key, provide a description and click Create API Key. Unlike SendGrid you can see your API’s at anytime.
Use the button below to sign up for a MailChimp account:
Install the PostSMTP plugin via the WordPress dashboard and activate it. By default the plugin will use whatever method is configured to send email on the server. We now need to configure it to use the chosen 3rd party service.
Once installed it is simply a case of clicking Start the Wizard, you will be asked to enter:
- The email address you want the emails to be from
- The name you wanted displayed
- The ‘real’ mail server for the domain (not needed as we will be using an API)
The plugin will then try to connect to the ‘real’ server, once this has finished, select the service you will be using, either SendGrid or Mandrill and then click next and enter the relevant API.
The system will then show you the notification options for what should happen if the email fails to send, for the time being you can click Next and complete the wizard.
Once configured we need to test, click Send a Test, enter an email address and click next. The message should be sent and you will see a confirmation message.
You can check that messages have been sent by checking the PostSMTP log. The last 250 emails are held in the database. The log will show each message along with the status. The status will either be Sent or the reason the message was rejected. You can view the session transcript, the message itself and can resend the message.
We can also check for this in the Mandrill and SendGrid dashboards to ensure that the email has reached the service and been sent.
PostSMTP is great for monitoring and alerts you if emails are not sent. When an email fails you can either get notified by email handy if it just emails to certain domains being blocked or, more useful to us anyway you can get notifications via Slack. We have a dedicated Slack Chanel that any notifications are sent to.
Fallback Feature – Using both SendGrid and Mandrill
So how or why would you use both? PostSMTP has a great feature, which is only found on this plugin (at the moment) and that is a Fallback option. We configure Mandrill as the main email processor and use SendGrid in SMTP mode as the fallback option. Like we say email messages from WordPress are important to us. Just remember if you use both your SPF record must contain the records for SendGrid and Mandrill:
v=spf1 include:spf.protection.outlook.com include:sendgrid.net include:spf.mandrillapp.com -all
Emails from WordPress are important and when they fail you or your customer can loose emails that pertain to orders, bookings, enquires and other important information from the visitors. Using PostSMTP and SendGrid and/or Mandrill will help to ensure that the email gets through. Both services enable you to check that emails have been received to the service and sent to the end customer, this helps solving issues if they do arise. PostSMTP also allows you to have a fall back option should the primary service fail and great alerting.
We use Mandrill as the additional requirements of DKIM and SPF mean that your message is more likely to get through.
You can use PostSMTP with any SMTP service, GMail API and MailGun API. We can’t comment on how good these solutions are because we don’t use them.