Migrate from Mailgun
Move from Mailgun
to OpenEmail.
Domains in the URL, o: options and v: variables, mapped field by field, with a converter that rewrites your code.
The same email,
written both ways.
One message with a reply-to address and a tag, sent through Mailgun and then through OpenEmail.
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 OpenEmail.
| Mailgun | OpenEmail | 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 OpenEmail 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 OpenEmail.
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 OpenEmail 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 contacts and suppressions
Import your contacts as a CSV on an audience page, and add the addresses Mailgun suppressed to the suppression list.
Webhook events,
renamed.
Each Mailgun event and the OpenEmail event that replaces it. Every request carries one event, signed.
| Mailgun | OpenEmail |
|---|---|
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 | suppression.added |
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.