3 Tips When Migrating to SparkPost from Postfix, Sendmail or Exim

Tom Mairs
Aug. 3, 2018 by Tom Mairs

This document outlines common ways our customers use SparkPost for general integration.  These integrations cover essential topics like “how do I send email?” and “how do I know what happened to the email?”  If you are transitioning from Postfix, Sendmail, or Exim, this document should explain everything you need to know about the basics of sending and reporting on email.  The rest of this document assumes you have an existing SparkPost account. If you don’t, go here to get one.

How do I send email?

SparkPost will accept mail for transfer in a couple of ways. By far, the most common is SMTP (Simple Mail Transfer Protocol) and SparkPost presents itself precisely as any other secure email agent on port 587. If you currently have generation or mail merge software that creates an email for delivery, SparkPost will accept it as a standard SMTP message and attempt to deliver it. You will need a system that with a valid TLS certificate that can generate SMTP messages and send them over port 587. Postfix, Sendmail, and Exim all have this capability natively.

Example 1:

You have a web server that generates a merged message for email delivery through Postfix.
· Adjust the web server’s generation software to send SMTP message to your assigned SparkPost server instead of the Postfix server
· Yes it really is that easy

Example 2:

You have some management code that needs to use the local server’s “Mail” function.
· If you are using Sendmail, edit the /etc/mail/sendmail.mc file to add a “smart-host” definition.
IE: define(`SMART_HOST',`smtp.MySparkPostServer.com')
· If you are using Postfix, edit the /etc/postfix/transport file to add an smtp relay definition.
IE: * smtp:MySparkPostServer.com
· Make sure you enable TLS and set your outbound port to 587.
· Apply the changes and restart the local mail services
IE: https://www.sparkpost.com/docs/integrations/postfix/
· Execute the management code as, and the mail will route to SparkPost for delivery

What about REST injection?

For customers who use HTTP(S) to transport data in their networks, converting a message to SMTP can be cumbersome. SparkPost has a comprehensive REST API that can accept a JSON template, list of recipients, and substitution data over HTTPS and then convert that into generated (merged) email to be sent to the world over standard SMTP. This is particularly helpful to off-load the generation work from web servers to the mail engine.

Example:

Your servers generate a newsletter to 50,000 recipients daily merging personal data then send each individually through Postfix.
· Create JSON objects for the recipients, substitution data, and content template.
· Use the REST API to POST the JSON objects to SparkPost’s Transmission API. Doing this offloads the generation process to SparkPost for faster delivery.
· You can even put the JSON in a file and use cURL:

How do I get delivery information?

SparkPost collects copious amounts of delivery information and makes that available to you in JSON format that can be “pushed” as a webhook or “pulled” with an API call. The data for a delivery looks something like this:

That is probably much more data than you are used to seeing in a Postfix log and it is already in a format that is easily consumable. It is relatively trivial to convert that JSON data to Postfix logging format if needed. Delivery, bounce, reject, spam_complaint, open, click, and delay data can be read the same way.

Examples:

1) You usually export Postfix logs out to Excel so you can sort and analyze.
A) Execute a message_events API call and run the resulting JSON data through JSON2CSV.

2) You like to convert your Postfix logs to JSON, then pull them into a web service for reading and analysis.
A) Use the SparkPost metrics API to poll SparkPost for the data you need, and it is automatically exported as JSON

3) You have a separate process that tails and parses the logs in real-time and updates a separate recipient database.
A) SparkPost can provide a real-time webhook that can feed your process spam_complaintants and unsubscribes specifically for this purpose. Implementation is trivial.

-Tom

Find out more here:
https://developer.sparkpost.com/api/webhooks.html
https://developer.sparkpost.com/api/message-events.html

Related Content

5 Do's (and 5 Dont's) for Better Marketing Emails

Want to improve your bottom line and customer engagement? Here are 5 do's and 5 dont's for sending better marketing emails.

read more

New Feature: A/B Testing API for Transactional Email and Notifications

Transactional email has unique testing requirements. SparkPost’s A/B Testing API is optimized for testing real-time use cases like app notifications.

read more

How to Generate Realistic Test Traffic Patterns in your SparkPost Account

Behold, a “bouncy sink” that behaves like real-world recipients and a “traffic generator” to easily test traffic patterns and complex sending environments.

read more

Get started and start sending

Try SparkPost and see how easy it is to deliver your app’s email on time and to the inbox.

Try Free

Send this to a friend