Migrate from SendGrid

Move from SendGrid
to Nextmail.

Point the SendGrid SDK at Nextmail and keep your code, or convert it to the Nextmail SDK. Personalizations, categories and the event webhook are mapped field by field.

The same email,
written both ways.

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

SendGrid
import sgMail from '@sendgrid/mail' sgMail.setApiKey(process.env.SENDGRID_API_KEY) try {  const [response] = await sgMail.send({    from: { email: 'billing@acme.com', name: 'Acme' },    to: 'ada@example.com',    replyTo: 'support@acme.com',    subject: 'Your invoice is ready',    html: '<p>Thanks for your order.</p>',    categories: ['invoice'],  })  console.log(response.statusCode)} catch (error) {  console.error(error.response?.body ?? error)}
Nextmail code
import { init, nextmail } from '@nextmail/sdk' init({ apiKey: process.env.NEXTMAIL_API_KEY }) try {  const email = await nextmail.emails.send({    from: { email: 'billing@acme.com', name: 'Acme' },    to: 'ada@example.com',    replyTo: 'support@acme.com',    subject: 'Your invoice is ready',    html: '<p>Thanks for your order.</p>',    tags: { category: 'invoice' },  })  console.log(email.status)} catch (error) {  console.error(error.message)}

Field by field,
what goes where.

Each option SendGrid takes, and its place in Nextmail.

SendGridNextmailNotes
personalizations[].totoOne message per personalization.
reply_toreplyToOne address per message.
content[]html, textOne field per content type.
template_id, dynamic_template_datatemplate: { id, props }Recreate the template in Nextmail first.
categories, custom_argstagsUp to 10 key and value pairs.
send_atscheduledAtA date instead of Unix seconds.
tracking_settingstracking: { opens, clicks }Two switches on each message.
attachments[].typeattachments[].contentTypeBase64 or bytes, 5 MB in total.
batch_idemails.cancel(id)Cancel each message by its own id.
asm.group_idsuppressions.addUnsubscribes go to one suppression list.

Converter

Paste your SendGrid 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 SendGrid
Your SendGrid 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 SendGrid key. Suppressions, lists, contacts, templates and webhooks come across, and domains and keys arrive as a checklist.

Webhook events,
renamed.

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

SendGridNextmail
processedemail.sent
deliveredemail.delivered
deferredemail.delivery_delayed
bounceemail.bounced
droppedemail.suppressed
spamreportemail.complained
openemail.opened
clickemail.clicked
unsubscribecontact.unsubscribed
group_unsubscribecontact.unsubscribed
group_resubscribecontact.resubscribed

Moving from SendGrid,
answered.

Converted?
Create the key it reads.

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