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.
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)
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.
| Mailgun | Nextmail | Notes |
|---|---|---|
messages.create(domain, …) | from | The domain of the from address decides. |
h:Reply-To | replyTo | One address per message. |
h:X-* | headers | One object of names and values. |
o:tag, v:* | tags | Up to 10 key and value pairs. |
o:deliverytime | scheduledAt | An ISO time instead of an RFC 2822 date. |
o:tracking-opens, o:tracking-clicks | tracking: { opens, clicks } | Booleans instead of yes and no. |
template, t:variables | template: { id, props } | Recreate the template in Nextmail first. |
attachment | attachments | Base64 or bytes, 5 MB in total. |
recipient-variables | emails.sendBatch | One 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.
Beyond the code,
four more steps.
- 01
Add your sending domain
Add it in Nextmail and publish the DNS records it lists. Sending starts once the signing record answers.
- 02
Create an API key
Keys start with oe_live_ and carry only the scopes you give them.
- 03
Move your webhooks
Create an endpoint for the events listed below and check the X-OpenEmail-Signature header on every request.
- 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.
| Mailgun | Nextmail |
|---|---|
accepted | email.sent |
delivered | email.delivered |
failed (temporary) | email.delivery_delayed |
failed (permanent) | email.bounced |
complained | email.complained |
opened | email.opened |
clicked | email.clicked |
unsubscribed | contact.unsubscribed |
Moving from Mailgun,
answered.
Moving from
somewhere else?
Every guide has the same converter, field map and checklist.
Converted?
Create the key it reads.
A workspace takes a minute. Add your domain, create an API key and set OPENEMAIL_API_KEY.