Migrating from Mandrill to SparkPost on Heroku

Dave Gray
Feb. 27, 2016 by Dave Gray

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.

4 Comments

  • Thanks! But a comma is missing after “authentication: :login”

    Reply
  • Good catch! We’ve updated it 🙂

    Reply
  • Consider adding the information about enabling tracking – Mandrill has open and click tracking by default and a migrating user expects those with your platform.

    For me I had to do some digging and trial and error to find out that I need to add to my mailer:

    default ‘X-MSYS-API’ => ({
    “options” => {
    “open_tracking” => true,
    “click_tracking” => true
    }}).to_json

    Reply
  • How to install it without heroku? I don’t want to pay $7 per month to heroku.

    Reply

Share your Thoughts

Your email address will not be published.

Related Content

Community Spotlight: How Topol Makes Creating Beautiful HTML Email Templates Easy

Building HTML email templates is hard. Learn about the app that Jan Tlapak and Sendmark created for anybody in need of building beautiful HTML emails.

read more

5 Easy Ways to Enhance Your Customer Segmentation Strategy

With hundreds of ways to segment email lists and personalize campaigns, these 5 methods of customer segmentation are an easy place to start.

read more

Learn To Love Your Unsubscribers

Unsubscribers are inevitable in email marketing. They’re often looked at negatively, but we prove how they do a lot of work for marketers by cleaning lists.

read more

Start sending email in minutes!

The world’s most powerful email delivery solution is now yours in a developer-friendly, quick to set up cloud service. Open a SparkPost account today and send up to 100,000 emails per month for free.

Send 100K Emails/Month For Free

Send this to a friend