Migrate from Mailgun

Move from Mailgun
to Nextmail.

Point the Mailgun SDK at Nextmail and keep your code, or convert it to the Nextmail SDK. Domains, o: options and v: variables are mapped field by field.

The same email,
written both ways.

One message with a reply-to address and a tag, sent through Mailgun and then through Nextmail.

Mailgun
import FormData from 'form-data'import Mailgun from 'mailgun.js' const mailgun = new Mailgun(FormData)const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY }) const result = await mg.messages.create('mg.acme.com', {  from: 'Acme <[email protected]>',  to: ['[email protected]'],  subject: 'Your invoice is ready',  html: '<p>Thanks for your order.</p>',  'h:Reply-To': '[email protected]',  'o:tag': ['invoice'],}) console.log(result.id)
Nextmail code
import { init, openemail } from '@openemail/sdk' init({ apiKey: process.env.OPENEMAIL_API_KEY }) const email = await openemail.emails.send({  from: 'Acme <[email protected]>',  to: ['[email protected]'],  subject: 'Your invoice is ready',  html: '<p>Thanks for your order.</p>',  replyTo: '[email protected]',  tags: { tag: 'invoice' },}) console.log(email.id)

Field by field,
what goes where.

Each option Mailgun takes, and its place in Nextmail.

MailgunNextmailNotes
messages.create(domain, …)fromThe domain of the from address decides.
h:Reply-ToreplyToOne address per message.
h:X-*headersOne object of names and values.
o:tag, v:*tagsUp to 10 key and value pairs.
o:deliverytimescheduledAtAn ISO time instead of an RFC 2822 date.
o:tracking-opens, o:tracking-clickstracking: { opens, clicks }Booleans instead of yes and no.
template, t:variablestemplate: { id, props }Recreate the template in Nextmail first.
attachmentattachmentsBase64 or bytes, 5 MB in total.
recipient-variablesemails.sendBatchOne entry per recipient, values filled in.

Converter

Paste your Mailgun code,
get it back on Nextmail.

Pick where the code comes from and its language. Recognised keys are removed in your browser, and nothing you paste is kept.

From Mailgun
Your Mailgun code
Nextmail code

Your Nextmail code appears here

Paste a file, or load an example, then convert.

0 of 12,000 charactersRecognised keys are removed before sending.

Beyond the code,
four more steps.

  1. 01

    Add your sending domain

    Add it in Nextmail and publish the DNS records it lists. Sending starts once the signing record answers.

  2. 02

    Create an API key

    Keys start with oe_live_ and carry only the scopes you give them.

  3. 03

    Move your webhooks

    Create an endpoint for the events listed below and check the X-OpenEmail-Signature header on every request.

  4. 04

    Bring the rest with one key

    In Migrations, choose From a provider and paste a Mailgun key. Suppressions, mailing lists, members, templates and webhooks come across, and domains and keys arrive as a checklist.

Webhook events,
renamed.

Each Mailgun event and the Nextmail event that replaces it. Every request carries one event, signed.

MailgunNextmail
acceptedemail.sent
deliveredemail.delivered
failed (temporary)email.delivery_delayed
failed (permanent)email.bounced
complainedemail.complained
openedemail.opened
clickedemail.clicked
unsubscribedcontact.unsubscribed

Moving from Mailgun,
answered.

Converted?
Create the key it reads.

A workspace takes a minute. Add your domain, create an API key and set OPENEMAIL_API_KEY.