Easily Migrate from Mailgun to SparkPost 

The only full-featured email service built on AWS.

JOIN THE WEBINAR:

Looking for the best email service provider?

Learn why 25% of the world's legitimate email is sent through SparkPost.

Get the white paper

Bacon ipsum dolor amet tenderloin pig cupim tail prosciutto. Tail chicken bacon, burgdoggen jowl biltong kielbasa corned beef. Ribeye rump spare ribs pork loin hamburger cupim chicken tail biltong andouille cow shoulder doner alcatra. Pork belly burgdoggen frankfurter pig pastrami leberkas, pork loin short ribs turducken porchetta venison. Bacon pork chop capicola, ham hock burgdoggen hamburger rump shankle meatloaf brisket.

Placeholder Subhead

  • Bacon ipsum dolor amet tail brisket short ribs, pork chop rump frankfurter turducken swine tenderloin cow landjaeger porchetta. Cupim capicola cow, ribeye jerky leberkas boudin meatball jowl beef ribs chicken.
  • Bacon ipsum dolor amet tail brisket short ribs, pork chop rump frankfurter turducken swine tenderloin cow landjaeger porchetta. Cupim capicola cow, ribeye jerky leberkas boudin meatball jowl beef ribs chicken.
  • Bacon ipsum dolor amet tail brisket short ribs, pork chop rump frankfurter turducken swine tenderloin cow landjaeger porchetta. Cupim capicola cow, ribeye jerky leberkas boudin meatball jowl beef ribs chicken.
  • Bacon ipsum dolor amet tail brisket short ribs, pork chop rump frankfurter turducken swine tenderloin cow landjaeger porchetta. Cupim capicola cow, ribeye jerky leberkas boudin meatball jowl beef ribs chicken.

Bacon ipsum dolor amet tenderloin pig cupim tail prosciutto. Tail chicken bacon, burgdoggen jowl biltong kielbasa corned beef. Ribeye rump spare ribs pork loin hamburger cupim chicken tail biltong andouille cow shoulder doner alcatra. Pork belly burgdoggen frankfurter pig pastrami leberkas, pork loin short ribs turducken porchetta venison. Bacon pork chop capicola, ham hock burgdoggen hamburger rump shankle meatloaf brisket.

This guide is here to help make your move from Mailgun to SparkPost as smooth as possible. We’ll walk through the key setup steps and highlight the differences in technology and terminology along the way. 

Triggered email is the fundamental core of our business, and our love for developers runs deep. SparkPost makes it easy to make the switch without impact on your business. We know you have a lot of questions about what the migration process entails and how easily this change can be made, so we created this MailGun Migration Guide to help explain how quick and painless migrating to SparkPost can be.

Here's what you need to know:

New center aligned plain paragraph style, ribeye tip frankfurter tri-tip beef sirloin filet mignon chuck. Prosciutto pastrami pork chop beef beef ribs kevin, ground round spare ribs tip meatloaf tongue tail tenderloin. Pork loin venison meatball, doner ham hock pancetta meatloaf shank boudin spare ribs.

Terminology

First here’s a quick primer on the main terminology differences between the two services.

SparkPost term Mailgun term
Sink server Test mode
Metrics Stats
Message events Events (formerly logs)
Relay webhooks Routes
Substitution data Recipient variables / template variables
Metadata, tags my-custom-data / X-Mailgun-Variables
Transmissions Messages
Suppression Lists Suppressions
Sending domains, bounce domain, tracking domains, inbound domains Domains

Where To Get Help

If you’re in a hurry and just want the gritty details, check out our DevHub, API docs, and pricing. If you have general questions, take a walk through our support articles, or if you just want to chat, join our community on Slack.

Signing Up

Sign up for your free SparkPost account above or choose a paid option below. On sign-up, your free account has a 100k monthly email allowance and all service features are available.

Note: Please create only a single SparkPost account for your organization. If you need separate environments or to send on behalf of multiple clients, please use subaccounts. Both of these are explained in more detail below.

Sidebar: The SparkPost Dashboard

After sign-up and whenever you sign in, you'll see your SparkPost dashboard.  Along with your daily and monthly usage reports, the dashboard includes a section named 'Your Progress'. The steps outlined there form a useful 'onboarding' checklist so do take a moment to review.



First here’s a quick primer on the main terminology differences between the two services.

Sending Your First Email

At this point, you can send email, provided you use the sparkpostbox.com domain in your 'From' address (e.g. "From: [email protected]"). Each SparkPost account has a 50-email, lifetime allowance of mail from this 'sandbox' domain and it's meant as an easy exploration and testing feature. This is a little different than MailGun which creates a “sandbox domain” for you to get started with. MailGun also allows you to send to only 5 named recipients from your sandbox domain. SparkPost’s sandbox imposes no such limitation.

To begin sending real production emails, both MailGun and SparkPost expect you will use a domain of your own.

If you would like to jump straight in and send your first email, check out the REST API section below.  As with MailGun, you can also send via SMTP if you prefer.

Setting Up A Sending Domain

To begin sending mail from your own domain, you must tell SparkPost about it by adding it as a sending domain on your account. SparkPost will then check that you own it. You can create and manage your sending domains from Sending Domains in the Accounts menu.

MailGun’s domains group sending, tracking and receiving domain configuration together.  By comparison, SparkPost separates these concepts into sending, bounce, tracking, and inbound domains and each can be configured separately.

To verify your sending domain, you can opt to receive an email to the abuse@ or postmaster@ account for your domain or you can publish SPF or DKIM DNS records for it.

Note: SparkPost only requires that you complete 1 type of domain ownership verification. However, we recommend that you configure at least DKIM on your domains, as this will improve your domain’s reputation, and thus, your chances of consistently hitting the inbox.

Sidebar: Service Providers

If you send on behalf of multiple customers through their own sending domains, you are probably familiar with MailGun’s per domain SMTP and API credentials. SparkPost’s analog is its subaccounts feature, which offers separate credentials, domains, and message events along with an API for programmatic onboarding of your customers. Similar to MailGun’s per domain config, each SparkPost subaccount gets its own API key, and each sending domain a DKIM DNS record. Your customer need only publish the DKIM key in their DNS and then use the API key to start sending email.

Important: Migrate Your Suppression List

When you use any modern email service, it will maintain a suppression list of recipients you should not send mail to; for example, people who unsubscribe from your list or complain about your messages, as well as email addresses which are invalid. It’s like your own personal “do not call” list.

When switching email providers, it’s very important to avoid sending to these addresses again to avoid incurring very high bounce and complaint rates early on. If this happens, we may even have to suspend your account to protect you and our other customers’ reputations. Migrating your suppression list from the old service into the new should be one of your first actions.

MailGun’s suppression list collects recipients whose email has bounced, who have complained or who have unsubscribed from your communications. SparkPost’s suppression list is similar - you can manage it within SparkPost and it also includes an API endpoint for bulk uploading your suppression list.

Migrating To The SparkPost REST API

The SparkPost REST API expects JSON requests, in contrast to MailGun’s form-data request formatting.  Both respond with JSON.  The most commonly used part of the SparkPost API is the transmissions endpoint, which is broadly equivalent to MailGun’s messages endpoint since  SparkPost transmissions support similar single, batch and scheduled send features.

As a side note, while many MailGun API endpoints are scoped by sending domain, SparkPost prefers top-level API endpoints in most cases. For example, to send mail from example.com, MailGun might expect a call to https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages, a SparkPost user would call https://api.sparkpost.com/api/v1/transmissions.

Note: MailGun includes mailing lists for maintaining a list of recipients you regularly communicate with. The SparkPost transmissions endpoint is most often used with inline recipients rather than a stored list. SparkPost also has a recipient list capability but it is intended as a short-term cache for your recipient list and not as a database of record for your mailing lists.

You can call the SparkPost API directly using tools like Postman, cURL or HTTPie but it’s more common to use one of our official client libraries:

Our thriving developer community also maintains libraries for other languages and platforms including C# and Ruby.

Whichever tools you choose, you will need to issue yourself an API key to start using the SparkPost API. Unlike MailGun’s credential per domain policy, you can create as many API keys as you need, each with their own privileges so you can compartmentalize access rights across your software stack and organization.

Sending Mail Over SMTP

SparkPost also accepts email over traditional SMTP - with a few modern twists. In short, you can set metadata, tags, and configuration options by including a custom header named X-MSYS-API in your messages which is roughly analogous to MailGun’s X-MailGun- headers. You can read the full SparkPost SMTP API reference documentation here.

Note: If you’d like to use advanced features like dynamic message generation with templates and personalization, you should use the REST API’s transmission, template, and substitution capabilities.

Templates

SparkPost templates offer the same basic variable substitution capabilities that are available with MailGun’s recipient and template variables but where MailGun relies upon fixed key/value pairs, SparkPost substitution data supports structured recipient data.  SparkPost’s templates also support logic and iteration to translate rich recipient data into customized and preference-driven email content. SparkPost can also store templates within your account for re-use and to separate content management from the API calls that trigger delivery.

It’s worth remembering that SparkPost wraps substitution variables with double braces in contrast to MailGun’s percent delimiters. Here are a few example template snippets to show what’s possible:

  • Basic substitution: Hello
  • Default values: Hello
  • Conditionals: Miaow! Woof!

To explore further, you can create, edit and preview your templates (using test substitution data) within SparkPost and also using the templates API endpoint.

Tracking Your Email Activity

SparkPost offers 2 levels of tracking information. The first is aggregate metrics which are a richer and more complete form of MailGun stats - rolled up, time windowed summaries of your mailing and recipient activity. Metrics are viewable as customizable time series graphs and also available programmatically using our metrics API endpoint. The second level of tracking information exposes the more fine-grained individual activity used to build our aggregate metrics. This individual activity is also available two ways - through our message events interface, or by making use of our message events API endpoint and webhooks features which let you process the data however you like.

Metrics

Your SparkPost account includes an extensive set of metrics for tracking your email activity. You can review summary reports, a breakdown of bounces and engagement (our term for opens and clicks), and more.  All of these reports can be narrowed by a time window and are calculated down to the minute. If you choose to set a campaign ID on your transmissions, metrics can also be filtered using those campaign ID values and by other fields such as recipient domain and IP pool. See the documentation linked above for a complete list of querying and filtering capabilities.

All SparkPost metrics are stored on your account for 6 months.

Message Events and Webhooks

SparkPost’s message events API endpoint provides similar functionality (and then some!) to MailGun’s events capability: the message events report is a searchable view of the last 10 days of events on your account. Those events are available in pull fashion by querying the message events endpoint directly and in push fashion if you use the webhooks facility.

Where MailGun supports a single webhook per domain and event type, one may create as many SparkPost webhooks as required, each filtered to receive one or more types of events.

Here's a mapping of each MailGun event to its SparkPost message event equivalent(s):


Mailgun event SparkPost event
accepted injection
rejected policy_rejection, generation_rejection
delivered delivery
failed bounce, out_of_band
opened open
clicked click
unsubscribed list_unsubscribe, link_unsusbcribe
complained spam_complaint
stored -

Event Specifications

The SparkPost API includes embedded JSON specifications and sample event generation services for both message events and webhooks.

Metadata

SparkPost provides metadata and tag facilities for labeling your email activity with information from your application, similar to MailGun’s my-custom-data API field and X-MailGun-Variables SMTP header.

You can provide metadata with your transmissions, both at the request level and for each individual recipient, with recipient metadata overriding the top-level values. As with MailGun, any metadata you provide at message send time will later be available in all events relating to that message, both through message events and webhooks.

Note: If you use SMTP, metadata and tags can also be set using the X-MSYS-API message header.

Inbound Email

SparkPost’s relay webhooks process and forward email addressed to an HTTP endpoint you control, much like using MailGun's routes mechanism and its forward() action. Each relay webhook accepts SMTP traffic on your behalf, and forwards JSON-encoded messages to you over HTTP. SparkPost's relay webhooks are conceptually simpler than MailGun's routes in that any matching, filtering or storage must take place in your HTTP service.

Note: SparkPost requires that you register your inbound domain before you can receive inbound mail through a relay webhook.

If you have general questions, feedback or want to chat about your particular situation, come find us on Slack! If you have an issue with your SparkPost account, you can check out our support articles here and contact our Support team directly here.

Swine bacon hamburger shank venison meatball kielbasa flank sirloin. Salami jowl hamburger sirloin fatback pork chop beef beef ribs kevin belly beef ribs.

Flexible pricing that fits the way you send.

Try SparkPost for free and send 500 emails/month, no credit card required.

500
emails / month
Free
500 / free for testing and development
50,000
emails / month
$
20
EXTRA EMAILS:
$1.00 / thousand
100,000
emails / month
$
30
EXTRA EMAILS:
$0.85 / thousand
High Volume
Save on volumes of 5M / month and up
PREMIER

100,000
emails / month
$
75
EXTRA EMAILS:
$0.85 / thousand
PREMIER

250,000
emails / month
$
170
EXTRA EMAILS:
$0.70 / thousand
PREMIER

500,000
emails / month
$
290
EXTRA EMAILS:
$0.60 / thousand
PREMIER

1 Million
emails / month
$
525
EXTRA EMAILS:
$0.55 / thousand

* All Premier packages include a dedicated IP, automated IP warm-up, prioritized support, and more.

500
emails / month
Free
500 / free for testing and development
50,000
emails / month
$
20
EXTRA EMAILS:
$1.00 / thousand
100,000
emails / month
$
30
EXTRA EMAILS:
$0.85 / thousand
High Volume
Save on volumes of 5M / month and up
PREMIER

100,000
emails / month
$
75
EXTRA EMAILS:
$0.85 / thousand
PREMIER

250,000
emails / month
$
170
EXTRA EMAILS:
$0.70 / thousand
PREMIER

500,000
emails / month
$
290
EXTRA EMAILS:
$0.60 / thousand
PREMIER

1 Million
emails / month
$
525
EXTRA EMAILS:
$0.55 / thousand

* All Premier packages include a dedicated IP, automated IP warm-up, prioritized support, and more.


See how easy it is to make the switch and integrate with your systems.

cash bundle

Visit Our Dev Hub

Get sample code, client libraries, and more just for developers.

laptop with graduation cap

See Our API Docs

Browse our comprehensive email APIs & transactional email APIs.

Puzzle Pieces

View Support Articles

Bookmark our easy-to-use help and support docs for reference.

cash bundle

Yield big rewards with small improvements

Explore the impact on revenue of choosing the right email provider.

Learn More
laptop with graduation cap

Email Best Practices 101

Discover 15 proven tatics for boosting deliverability and engagement.

Download Now
Puzzle Pieces

Shared vs Dedicated Email Environments

Understand the business impact of using a dedicated IP versus a shared address.

Get The Guide
cash bundle

Yield big rewards with small improvements

Explore the impact on revenue of choosing the right email provider.

Learn More
laptop with graduation cap

Email Best Practices 101

Discover 15 proven tatics for boosting deliverability and engagement.

Download Now
Puzzle Pieces

Shared vs Dedicated Email Environments

Understand the business impact of using a dedicated IP versus a shared address.

Get The Guide

Free Download: The Impact on Revenue of Choosing the Right Email Provider

An often overlooked criteria when choosing an ESP is deliverability. Ensuring the successful delivery of email through thousands of mailbox providers and ISPs is no easy task - it requires a highly specialized sending infrastructure built for today's email needs. Not even the most sophisticated data analytics or one-to-one targeting programs will help if your email never arrives in the inbox.

In this paper, we explore the difference in deliverability between SparkPost and other email service providers and show how that adds up to billions of dollars in missed revenue. We show you:

  • Why companies who rely on email choose SparkPost
  • What an 8% lift in email deliverability means to your business
  • How deliverability rates differ across email service providers

Don't settle for the status quo when it comes to deliverability with your email service provider.

Download our executive brief, "The Big Rewards of Email Deliverability" to learn more about why you should be paying attention to the deliverability rates of email service providers.

Want to take us for a test drive?

Send up to 10,000 emails / month for free

sign up now

Presented by

Presenter One
First Lastname

Title Position Role Title Position Company Name

learn more >
Presenter Two
First Lastname

Title Position Role Title Position Company Name

learn more >
Presenter Three
First Lastname

Title Position Role Title Position Company Name

learn more >

Presented by

The world's most innovative companies rely on us.

Comcast
Twitter
Pinterest
Salesforce
Paypal
© 2018 All Rights Reserved