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
- 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.
- 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).
- Send a few test messages and look for
spf=pass,dkim=passanddmarc=passin the headers. - 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.
- Import your suppression list so you do not mail people who already bounced or unsubscribed. See Suppressions.
- 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 | ScrubiMail | Notes |
|---|---|---|
Authorization: Bearer re_... | X-API-Key: <key> | Create a key with the send scope. |
from ("Name <[email protected]>") | from_email and from_name | Split the address and the name. from_email must be on the domain of sending_domain_id. |
(domain implied by from) | sending_domain_id | Required. The id of your verified domain from GET /send/domains/. |
to (string or array) | to_email (one address), to_name | Make one call per recipient, or use POST /send/bulk/. |
subject | subject | Up to 998 characters. |
html | html_content | Required. |
text | text_content | Optional. Generated from the HTML when omitted. |
reply_to | reply_to | A single address. |
cc, bcc | Not supported on the API | Over SMTP you can add Cc and Bcc recipients; each one is a separate recipient and costs a credit. |
headers | Not supported on the API | Over 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_at | See the Sending API | Check that page for what scheduling support exists today. |
react | Not applicable | Render 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" }],
}),
});await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/", {
method: "POST",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
sending_domain_id: process.env.SCRUBIMAIL_DOMAIN_ID,
from_email: "[email protected]",
from_name: "Your Company",
to_email: "[email protected]",
subject: "Welcome",
html_content: "<p>Thanks for signing up.</p>",
tags: ["welcome"],
}),
});From SendGrid
| SendGrid | ScrubiMail | Notes |
|---|---|---|
Authorization: Bearer SG.... | X-API-Key: <key> | Create a key with the send scope (and send:bulk for bulk). |
from.email, from.name | from_email, from_name | from_email must be on the sending domain. |
personalizations[].to[].email, .name | to_email, to_name | One recipient per call. For many recipients use POST /send/bulk/ with recipients. |
personalizations[].cc, .bcc | Not supported on the API | Over SMTP, add the recipients as usual. |
personalizations[].subject, subject | subject | Up to 998 characters. |
content[] with type: "text/html" | html_content | |
content[] with type: "text/plain" | text_content | Generated from the HTML when omitted. |
reply_to.email | reply_to | A 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, substitutions | variables with {{tags}} | Rewrite your placeholders as {{name}}, or {{name|fallback}} for a default. Built-ins: email, name, first_name, last_name. |
template_id | Not on the send call | Store a template with POST /send/templates/ and use it in a campaign, or send its content yourself. |
categories, custom_args | tags | Strings only. Key-value arguments are not supported. |
personalizations[] with many recipients | POST /send/bulk/ recipients[] | Each recipient has email, optional name and optional variables. |
asm, tracking_settings | list_unsubscribe | One-click unsubscribe is added with list_unsubscribe: true or {{unsubscribe_url}}; bulk and campaigns always include it. |
send_at | See the Sending API | Check that page for what scheduling support exists today. |
Response 202, empty body, X-Message-Id header | Response 202 with a JSON body | The message_id is in the body. |
From Mailgun
| Mailgun | ScrubiMail | Notes |
|---|---|---|
Basic auth api:<key> | X-API-Key: <key> | Not Basic auth, and not a Bearer token. |
| URL contains the domain | sending_domain_id in the body | Look up the id with GET /send/domains/. |
from | from_email, from_name | Request 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, bcc | Not supported on the API | Over SMTP, add the recipients as usual. |
subject | subject | |
html | html_content | |
text | text_content | |
h:Reply-To | reply_to | |
h:X-Custom-Header | Not supported on the API | Over SMTP, headers are sent as written. |
attachment (file part) | attachments[] base64 | Read the file, base64-encode it, send filename, content, content_type. |
inline | attachments[] with content_id | Reference it as <img src="cid:YOUR_ID">. |
o:tag | tags | Array of strings. |
v:name and %recipient.name% | variables and {{name}} | Use {{name|fallback}} for defaults. |
template | Stored template, used by a campaign | See Templates. |
o:deliverytime | See the Sending API | Check that page for what scheduling support exists today. |
o:tracking, o:tracking-opens, o:tracking-clicks | See 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.
| Setting | ScrubiMail | Typical provider value you are replacing |
|---|---|---|
| Host | smtp.scrubimail.com | smtp.resend.com, smtp.sendgrid.net, smtp.mailgun.org |
| Port | 587 with STARTTLS | Often 465 (SSL) or 587 or 2525. ScrubiMail does not accept SSL on 465. |
| Username | Your ScrubiMail account email | resend, apikey, or a Mailgun SMTP login |
| Password | A ScrubiMail API key with the send scope | The provider's API key or SMTP password |
| From address | An address on a verified ScrubiMail domain | Same 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 with535. - 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.1unless 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
| Record | Host | Value |
|---|---|---|
| SPF | @ | v=spf1 include:_spf.scrubimail.com ~all, merged into your existing SPF record |
| DKIM | scrubimail._domainkey | v=DKIM1; k=rsa; p=<dkim_public_key> |
| DMARC | _dmarc | v=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 examples1._domainkey,resend._domainkeyork1._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 verifiedyourcompany.comdoes 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 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:
| Feature | Status |
|---|---|
| Inbound email (receiving and parsing mail, inbound routes) | Not supported. ScrubiMail only sends. |
| Automations, drip sequences and workflows | Not supported. Campaigns are one-off sends; trigger your own sends from your code. |
| Contact or audience management, segments, forms | Not supported. Recipients are passed with each bulk send or campaign. Keep your list in your own database. |
cc and bcc on the HTTP API | Not supported. Over SMTP they are accepted, one recipient and one credit each. |
| Custom headers on the HTTP API | Not 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 billing | Not supported. One account owns its domains and keys. You can create several keys with different scopes. |
| Visual email builder, A/B tests, send-time optimisation | Not supported. Starter templates and your own HTML only. |
| Webhooks and open or click tracking | Check Webhooks and Tracking for what exists today. Delivery status is always available by polling GET /send/status/{message_id}/ or history. |
| Bulk import of suppressions | Not 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].