Skip to main content
ScrubiMail

Migrating from Resend, SendGrid or Mailgun

If you already send transactional email through Resend, SendGrid or Mailgun, the move is mostly a changed endpoint and a few renamed fields. This page maps one to the other and lists what ScrubiMail does not do yet, so you can decide before you start.

Related:Email sendingSMTP relay

Checked against the API source on

A safe order of work

  1. Inventory what you use. List the send calls, templates, webhooks, suppression lists and attachments in your code. Check the what is not supported section against that list first.
  2. Add and verify the domain on ScrubiMail (Sending setup). You can publish its DNS records next to your existing provider's records, as long as you keep to one SPF record (see DNS changes).
  3. Send a few test messages and look for spf=pass, dkim=pass and dmarc=pass in the headers.
  4. Move low-risk traffic first, for example internal notifications, then a share of production traffic, then the rest. Keep your old provider live until the new path has run cleanly for a while.
  5. Import your suppression list so you do not mail people who already bounced or unsubscribed. See Suppressions.
  6. Validate your marketing list before the first campaign from the new domain. New sending infrastructure and a stale list is the easiest way to start with a bad reputation. See Deliverability.

Send API field mapping

ScrubiMail's send call is POST https://api.scrubimail.com/scrubimail/api/v1/send/ with the X-API-Key header and a JSON body. It sends one recipient per call; use POST /send/bulk/ for lists. Authentication is a plain X-API-Key header, not Authorization: Bearer: a key sent as a Bearer token is rejected.

From Resend

Resend POST /emails to ScrubiMail POST /send/
ResendScrubiMailNotes
Authorization: Bearer re_...X-API-Key: <key>Create a key with the send scope.
from ("Name <[email protected]>")from_email and from_nameSplit the address and the name. from_email must be on the domain of sending_domain_id.
(domain implied by from)sending_domain_idRequired. The id of your verified domain from GET /send/domains/.
to (string or array)to_email (one address), to_nameMake one call per recipient, or use POST /send/bulk/.
subjectsubjectUp to 998 characters.
htmlhtml_contentRequired.
texttext_contentOptional. Generated from the HTML when omitted.
reply_toreply_toA single address.
cc, bccNot supported on the APIOver SMTP you can add Cc and Bcc recipients; each one is a separate recipient and costs a credit.
headersNot supported on the APIOver SMTP your headers are sent as written.
attachments (filename, content, content_type, content_id)attachments (same four fields)content is base64. Up to 10 files and 10 MB. A path URL is not supported: fetch the file and send its content.
tags ([{name, value}])tags (array of strings)Stored in metadata.tags. Use plain labels, for example "welcome".
scheduled_atSee the Sending APICheck that page for what scheduling support exists today.
reactNot applicableRender to HTML in your own code and pass html_content.
Response { id }Response message_id (and id)202 with the message. Poll GET /send/status/{message_id}/.
await fetch("https://api.resend.com/emails", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.RESEND_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from: "Your Company <[email protected]>",
    to: ["[email protected]"],
    subject: "Welcome",
    html: "<p>Thanks for signing up.</p>",
    tags: [{ name: "category", value: "welcome" }],
  }),
});

From SendGrid

SendGrid POST /v3/mail/send to ScrubiMail POST /send/
SendGridScrubiMailNotes
Authorization: Bearer SG....X-API-Key: <key>Create a key with the send scope (and send:bulk for bulk).
from.email, from.namefrom_email, from_namefrom_email must be on the sending domain.
personalizations[].to[].email, .nameto_email, to_nameOne recipient per call. For many recipients use POST /send/bulk/ with recipients.
personalizations[].cc, .bccNot supported on the APIOver SMTP, add the recipients as usual.
personalizations[].subject, subjectsubjectUp to 998 characters.
content[] with type: "text/html"html_content
content[] with type: "text/plain"text_contentGenerated from the HTML when omitted.
reply_to.emailreply_toA single address string.
attachments[] (content, filename, type, disposition, content_id)attachments[] (content, filename, content_type, content_id)type becomes content_type. Give a file a content_id to send it as an inline image.
dynamic_template_data, substitutionsvariables with {{tags}}Rewrite your placeholders as {{name}}, or {{name|fallback}} for a default. Built-ins: email, name, first_name, last_name.
template_idNot on the send callStore a template with POST /send/templates/ and use it in a campaign, or send its content yourself.
categories, custom_argstagsStrings only. Key-value arguments are not supported.
personalizations[] with many recipientsPOST /send/bulk/ recipients[]Each recipient has email, optional name and optional variables.
asm, tracking_settingslist_unsubscribeOne-click unsubscribe is added with list_unsubscribe: true or {{unsubscribe_url}}; bulk and campaigns always include it.
send_atSee the Sending APICheck that page for what scheduling support exists today.
Response 202, empty body, X-Message-Id headerResponse 202 with a JSON bodyThe message_id is in the body.

From Mailgun

Mailgun POST /v3/{domain}/messages to ScrubiMail POST /send/
MailgunScrubiMailNotes
Basic auth api:<key>X-API-Key: <key>Not Basic auth, and not a Bearer token.
URL contains the domainsending_domain_id in the bodyLook up the id with GET /send/domains/.
fromfrom_email, from_nameRequest body is JSON, not multipart/form-data or form-encoded.
to (repeatable)to_email (one address), or recipients[] on /send/bulk/Mailgun's recipient-variables becomes recipients[].variables.
cc, bccNot supported on the APIOver SMTP, add the recipients as usual.
subjectsubject
htmlhtml_content
texttext_content
h:Reply-Toreply_to
h:X-Custom-HeaderNot supported on the APIOver SMTP, headers are sent as written.
attachment (file part)attachments[] base64Read the file, base64-encode it, send filename, content, content_type.
inlineattachments[] with content_idReference it as <img src="cid:YOUR_ID">.
o:tagtagsArray of strings.
v:name and %recipient.name%variables and {{name}}Use {{name|fallback}} for defaults.
templateStored template, used by a campaignSee Templates.
o:deliverytimeSee the Sending APICheck that page for what scheduling support exists today.
o:tracking, o:tracking-opens, o:tracking-clicksSee Open and click tracking

Switching over SMTP

If your app sends over SMTP you can usually migrate by changing four settings and the sending domain. Nothing else in your code has to change.

SMTP settings compared
SettingScrubiMailTypical provider value you are replacing
Hostsmtp.scrubimail.comsmtp.resend.com, smtp.sendgrid.net, smtp.mailgun.org
Port587 with STARTTLSOften 465 (SSL) or 587 or 2525. ScrubiMail does not accept SSL on 465.
UsernameYour ScrubiMail account emailresend, apikey, or a Mailgun SMTP login
PasswordA ScrubiMail API key with the send scopeThe provider's API key or SMTP password
From addressAn address on a verified ScrubiMail domainSame address, once the domain is verified
  • The username is the email address of your ScrubiMail account, not a fixed word like apikey. A key that belongs to a different account is refused with 535.
  • If your library uses implicit TLS on port 465, switch it to STARTTLS on port 587. See the framework guides.
  • If your app sets an envelope sender (Return-Path) on another domain, the relay refuses the message with 550 5.7.1 unless that domain is verified on your account too.
  • ScrubiMail does not render {{tags}} or add an unsubscribe link to SMTP messages. What you send is what is delivered. If you relied on your old provider to add an unsubscribe footer over SMTP, add your own.
  • The relay charges 1 sending credit per recipient address and the daily sending limit applies. See Limits and quotas.

Full settings and error codes are on the SMTP relay page.

DNS changes

Records you add for ScrubiMail
RecordHostValue
SPF@v=spf1 include:_spf.scrubimail.com ~all, merged into your existing SPF record
DKIMscrubimail._domainkeyv=DKIM1; k=rsa; p=<dkim_public_key>
DMARC_dmarcv=DMARC1; p=none; rua=mailto:[email protected]
  • Merge SPF, do not add a second record. A domain with two SPF records fails SPF. Keep your old provider's include while you migrate: v=spf1 include:sendgrid.net include:_spf.scrubimail.com ~all. Remove the old include once all traffic has moved. Mind the 10-lookup limit.
  • DKIM does not conflict. Each provider uses its own selector. ScrubiMail's selector is scrubimail, so it sits beside your old provider's key (for example s1._domainkey, resend._domainkey or k1._domainkey). Leave the old DKIM record until you have stopped sending through that provider.
  • DMARC is one record per domain. If you already have one, keep it. Verification only needs it to exist, and bulk sends require it.
  • Subdomains. If your old provider sent from mail.yourcompany.com, add that exact subdomain to ScrubiMail. A verified yourcompany.com does not cover its subdomains.
  • Return-path and tracking CNAMEs. Some providers ask for extra CNAME records for bounce handling or link tracking. ScrubiMail asks for none, so remove those only after you have stopped using the old provider.

Moving your suppression list

Export the bounces, unsubscribes and spam complaints from your old provider and add each address to ScrubiMail so you never mail them again. There is no bulk import endpoint for suppressions: add them one at a time with POST /send/suppressions/ (the key needs the suppressions scope, or no scopes). The reason is one of bounce, complaint, unsubscribe or manual.

Import suppressions from a file
import csv
import os
import requests

base = "https://api.scrubimail.com/scrubimail/api/v1"
headers = {"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]}

with open("old-provider-suppressions.csv") as f:
    for row in csv.DictReader(f):
        res = requests.post(
            base + "/send/suppressions/",
            headers=headers,
            json={"email": row["email"], "reason": "bounce"},
            timeout=30,
        )
        if res.status_code not in (200, 201, 400):  # 400: already suppressed
            res.raise_for_status()

Adding an address that is already on the list returns 400 (Email already suppressed), which you can ignore. Unsubscribe links that already went out in old emails point at your old provider; those still work there, so export again at the end of the migration.

What you gain: validation in the same account

The one thing the other providers do not give you is address validation next to sending, under the same key and the same credits system. A migration is a good moment to use it: run your existing list through `POST /validate-bulk/` before your first campaign from the new domain, and put `POST /validate/` behind your signup form. Hard bounces from dead addresses are the quickest way to damage a new domain's reputation. See Deliverability.

What ScrubiMail does not support yet

ScrubiMail is built for transactional and campaign sending plus validation. These things you may be used to elsewhere are not there:

Not supported today
FeatureStatus
Inbound email (receiving and parsing mail, inbound routes)Not supported. ScrubiMail only sends.
Automations, drip sequences and workflowsNot supported. Campaigns are one-off sends; trigger your own sends from your code.
Contact or audience management, segments, formsNot supported. Recipients are passed with each bulk send or campaign. Keep your list in your own database.
cc and bcc on the HTTP APINot supported. Over SMTP they are accepted, one recipient and one credit each.
Custom headers on the HTTP APINot supported. Over SMTP, headers are sent as written.
More than one recipient in a single POST /send/Not supported. Use bulk, a campaign, or one call per recipient.
Subaccounts and per-project API keys with separate domains and billingNot supported. One account owns its domains and keys. You can create several keys with different scopes.
Visual email builder, A/B tests, send-time optimisationNot supported. Starter templates and your own HTML only.
Webhooks and open or click trackingCheck Webhooks and Tracking for what exists today. Delivery status is always available by polling GET /send/status/{message_id}/ or history.
Bulk import of suppressionsNot supported. Add them one at a time.

If a missing feature blocks you, tell us at [email protected] before you migrate.

Something missing or wrong? Email [email protected].