Migration guide / Transactional email
Flatten personalizations into one email per recipient, map the event names, and move your suppression lists.
SendGrid's v3 mail/send wraps recipients in personalizations and the body in a content array. SMTPfast takes one flat email per request, or up to 100 in a batch. Most of the work is in three places: the send payload, the event webhook handler, and the bounce, spam report and unsubscribe lists you export from SendGrid.
SendGrid details checked against its own docs on 2026-12-02. Still deciding? SMTPfast vs SendGrid.
Before: SendGrid
curl -X POST https://api.sendgrid.com/v3/mail/send \
-H "Authorization: Bearer $SENDGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"personalizations": [{ "to": [{ "email": "[email protected]" }] }],
"from": { "email": "[email protected]", "name": "Acme" },
"subject": "Your receipt",
"content": [{ "type": "text/html", "value": "<p>Thanks for your order.</p>" }],
"custom_args": { "order_id": "1041" }
}'After: SMTPfast
curl -X POST https://smtpfa.st/api/v1/emails \
-H "Authorization: Bearer $SMTPFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <[email protected]>",
"to": [
"[email protected]"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order.</p>",
"tags": [
{
"name": "order_id",
"value": "1041"
}
],
"category": "transactional"
}'import { SMTPfast } from "@smtpfast/sdk";
const smtpfast = new SMTPfast(); // reads SMTPFAST_API_KEY
const { id } = await smtpfast.emails.send({
from: "Acme <[email protected]>",
to: ["[email protected]"],
subject: "Your receipt",
html: "<p>Thanks for your order.</p>",
tags: [
{
name: "order_id",
value: "1041",
},
],
category: "transactional",
});| SendGrid | SMTPfast |
|---|---|
| POST /v3/mail/send | POST /v1/emails, or POST /v1/emails/batch for up to 100 |
| personalizations[].to / cc / bcc | to, cc, bccStrings or arrays of strings, "Name <email>" allowed. One personalization becomes one email. |
| from { email, name } | from: "Name <email>" |
| reply_to / reply_to_list | reply_to (string or up to 50) |
| content [{ type, value }] | html, textLeave out text and SMTPfast generates it from the HTML. |
| attachments [{ content, filename, type, disposition, content_id }] | attachments [{ content, filename, content_type, content_id }]A content_id makes the part inline. Up to 10 files, 10 MB each, 25 MB of attachments per email. |
| custom_args, categories | tags [{ name, value }]Up to 50 per email. Stored with the email, returned by GET /v1/emails/:id and searchable in Logs. Webhook events do not carry them: look the email up by email_id. |
| send_at (unix time, up to 72 hours) | scheduled_at (ISO 8601, up to 30 days) |
| asm.group_id (unsubscribe groups) | category and topicsA transactional email has no unsubscribe link. For broadcasts, topics let people opt out of one kind of email. |
| No idempotency key | Idempotency-Key header |
| SendGrid | SMTPfast |
|---|---|
| Host smtp.sendgrid.net | Host smtp.smtpfa.st |
| Ports 25, 587, 2525 (STARTTLS), 465 (SSL) | Ports 587 and 2525, STARTTLSThere is no implicit TLS port (465). Use 587, or 2525 where 587 is blocked. |
| Username the string apikey | Username smtpfast |
| Password API key | An SMTPfast API key with the email:send scope |
| SendGrid | SMTPfast |
|---|---|
| processed | email.sent |
| delivered | email.delivered |
| deferred | email.delivery_delayedNot the same event: it fires when SMTPfast retries handing the email to its provider, not for delays at the receiving server, which SMTPfast does not report. |
| bounce (type bounce or blocked) | email.bouncedbounce_type is Permanent, Transient or Undetermined. |
| dropped | email.suppressed or email.failed |
| spamreport | email.complained |
| open, click | email.opened, email.clicked |
| unsubscribe, group_unsubscribe | email.unsubscribed |
| group_resubscribe | No equivalent |
| A JSON array of events, signed with ECDSA | One event per request, signed with HMAC-SHA256 (X-SMTPfast-Signature) |
| SendGrid | SMTPfast |
|---|---|
| Dynamic templates (Handlebars), template_id d-... | Templates with {{{VARIABLE}}}, template: { id, variables }Variables are strings or numbers. No #if or #each. |
| dynamic_template_data | template.variables |
| Bounces, Spam Reports, Invalid Emails, Blocks | Suppressions, scope allReview blocks before you import them: a receiving server can refuse mail for reasons other than the address. |
| Global Unsubscribes, Group Unsubscribes | Suppressions, scope marketingThey stop marketing email and let transactional mail through. |
| Marketing Campaigns contacts | ContactsPOST /v1/contacts with { contacts: [...] }, 500 per call. |
Add the domain in the dashboard (or with POST /v1/domains) and publish the records it shows: three DKIM CNAMEs, an MX and an SPF TXT record for the bounce subdomain (MAIL FROM), and include:amazonses.com in the SPF record of the domain. A domain has one SPF record, so add the include to the one you have. The DKIM and bounce records have their own names, so they sit next to your current provider's records and both can send while you switch. Keep your DMARC record if you have one. On Cloudflare DNS, SMTPfast can add the records for you.
Create a key with the email:send scope for the app that sends. Give webhook and contact jobs their own keys with only the scopes they need (webhook:write, contact:write).
Turn each personalization into one email: to, cc and bcc move to the top level, content becomes html and text, custom_args become tags. If one request sent many personalizations, send them as one POST /v1/emails/batch of up to 100 items. Add category: "transactional" to mail people need; SMTPfast treats an email without it as marketing.
Create each dynamic template as an SMTPfast template, with {{name}} written as {{{NAME}}}. Logic such as {{#each items}} has no equivalent, and variable values are escaped, so you cannot pass HTML into a template. Render those emails fully in your code and send html instead.
In SendGrid, download the CSVs for bounces, spam reports and global unsubscribes (Export CSV, Download as CSV), or page through GET /v3/suppression/bounces and the other lists. Add bounces and spam reports with POST /v1/suppressions/batch/add, 100 per call. Add unsubscribes one at a time with scope marketing, so they still get receipts.
# Unsubscribed from marketing: block marketing only
curl -X POST https://smtpfa.st/api/v1/suppressions \
-H "Authorization: Bearer $SMTPFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "email": "[email protected]", "scope": "marketing" }'Create a webhook for email.delivered, email.bounced, email.complained and the other events you handled and check the X-SMTPfast-Signature header: a hex HMAC-SHA256 of the raw body with the webhook's signing secret. Every event body is { type, timestamp, data }. Failed deliveries are retried 4 more times over about 36 minutes, and you can replay any of them from the delivery log.
import crypto from "node:crypto";
// rawBody: the request body exactly as received, before JSON.parse
function isFromSmtpfast(rawBody: string, signature: string, secret: string) {
const expected = crypto.createHmac("sha256", secret).update(rawBody).digest();
const given = Buffer.from(signature, "hex");
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}Send to an address you own and check the email in Logs, then in the received message headers (DKIM and SPF pass, aligned with your From domain). Move one kind of mail first, such as password resets, and watch bounces and complaints for a few days before you move the rest. A new account has warm-up limits, so a large list should not move in one day.
Check these before you move. If one is a blocker, stay where you are.
Both become tags, an array of name and value pairs. They are stored with the email: GET /v1/emails/:id returns them and you can filter Logs by them. Webhook events carry the email_id, not the tags, so look up the email when a handler needs them.
Mail in an unsubscribe group was usually marketing. Send it with category marketing (the default) and SMTPfast adds a one-click unsubscribe link. Import the group's unsubscribes as marketing suppressions. Receipts and password resets go out as transactional and are not blocked by a marketing opt-out.
Yes. The DKIM records and the bounce subdomain have their own names, and one SPF record can include both senders. Move one kind of mail at a time and keep SendGrid until its last webhook arrives.
Verify a domain, send a test and check it in Logs before you move any traffic. Webhooks and inbound mail need a paid plan.