Mandrill Heroku SparkPost Alternative

Welcome to SparkPost! This article will show how to migrate existing applications that send using SMTP from Mandrill to SparkPost. We’ll be adding some variables to your Heroku environment, and once that’s done, your app will need to be updated to use the new variables.

Domain Setup

SparkPost is setup with a sandbox domain which can be used to send up to 5 messages. To send more messages, create a sending domain via the SparkPost dashboard or the API.

In order to properly sign and authenticate messages sent through your account, there are some changes you’ll need to make up front. Verifying your sending domain is described in detail in our Support Center. This is one of the ways we protect your domain reputation, as well as our own reputation, from being tainted by e.g. phishing.

Installing the SparkPost add-on

First, lets install the add-on using the heroku  CLI:

Next, let’s confirm that the SparkPost API key is configured, and add it to the local environment variables:

Credentials and other sensitive configuration values should not be committed to source-control. In Git, you can exclude the

file with

Using the SparkPost config settings in your app

Here’s an ActionMailer example adapted from the Mandrill page:

Check out the SparkPost add-on page for more examples, and our API docs for examples of how we can handle generating messages for you using our Transmission API.

Thanks for choosing SparkPost! If you have questions, feel free to contact us on Twitter @SparkPost, ask a question on StackOverflow, or join us on Slack.

mandrill alternative

Surprised by news from Mandrill? We understand how frustrating that can be, and we have a Mandrill alternative for you. If you want to get started with SparkPost fast, our developer community has got you covered! Here’s a quick guide to getting started and getting your transactional emails up and running.

TL;DR

  1. Create a SparkPost account
  2. Configure sending domains, DKIM, and SPF
  3. Migrate to the SparkPost API
  4. Migrate your templates
  5. Build something awesome

1. Create a SparkPost Account

First, sign up for a free SparkPost account if you haven’t already. BTW, we’ve made the pricing really easy: up to 100,000 emails/month for free.

2. Configure Sending Domains, DKIM, and SPF

Check out our Getting Started Walkthrough video for an easy quick start. If video’s not your thing, simply follow the in-app SparkPost dashboard as it walks you through the basic account configuration steps.

3. Migrate to the SparkPost API

SparkPost’s API is fantastic. Here’s the API documentation. As a general rule, if you see it in our UI, you can access it in our API, too.

API Clients

Just want to get your hands in some code? You’ll find client libraries for the usual suspects on GitHub (and maybe some unusual ones, too):

Basic Concepts

Sending: Transmissions

The Transmissions endpoint is the business end of SparkPost’s email sending capability. It supports both transactional and non-transactional mail streams, templating, tracking, variable substitution, attachments and all the usual goodies. It’s documented here with sample code in all the usual languages.

Sending: SMTP

You can also use traditional SMTP to inject your mail into SparkPost. Here’s an intro video and documentation for the readers.

Receiving: Relay Webhooks

On the inbound side, you can use our Relay Webhooks along with Inbound Domains to accept inbound mail.

Tracking: Webhooks and Message Events

Beyond delivery and receipt, you can use Webhooks or the Message Events endpoint keep track of deliveries, bounces, opens, clicks, and all the other events SparkPost emits.

BTW, here’s a definitive reference to the available events.

Translating Mandrill to SparkPost Terminology

Mandrill and SparkPost use slightly different nomenclature to describe similar functions. Here’s a SparkPost terminology primer for those coming from Mandrill’s API.

Mandrill Says
SparkPost Says
Notes
merge vars substitution data SparkPost’s substitution data is similar to Mandrill’s with rich JSON-like structure.
messages/search-time-series metrics SparkPost Metrics offer time-series aggregate views on everything to do with your mail streams. They also power the reporting UI.

messages/send

messages/send-template

messages/send-raw

transmissions A single endpoint for all types of transmission.

 4. Migrate Your Templates

**Update: we have an awesome new Mandrill-to-SparkPost template migration tool! Now, it’s even easier to get started with SparkPost as a Mandrill alternative. If that sounds good to you, go get it and read how to use the tool to convert and migrate your Mandrill templates.

Like Mandrill, SparkPost’s templates use a handlebars-like syntax with {{braces}}  surrounding variables.  You can edit templates in the SparkPost UI or directly using the templates API endpoint.

If you’re just pulling variables into your template for simple personalization, you might be able to use your Mandrill templates unchanged with SparkPost.  Otherwise, here are a few syntax pointers.

Feature
Mandrill Syntax
SparkPost Syntax
conditions
loops
nested variables
variables

5. Build Something Awesome

Support Resources

  • General help: You can find help with most questions about SparkPost functionality, account configuration, and our web app in the SparkPost Support Center.
  • Developer stuff: For help with code and general developer support, the SparkPost Developer Hub is a great resource. And, if you want to chat something through with our developer community team, join our Slack community.

Integrations

–Ewan

we love developers