Skip to main content

Migrating from Twilio SendGrid to Mailofly

SendGrid has long been an industry standard for email delivery, but developers frequently struggle with its deeply nested personalizations API structure, dated dashboard interface, slow customer support, and complex pricing tiers. Mailofly offers an elegant, high-throughput modern replacement with transparent pricing, instant logs, clean APIs, and zero payload nesting.

Why Developers Migrate from SendGrid

  • Simplified Payload Schema: Say goodbye to personalizations[0].to[0].email and multiple content objects. Mailofly uses flat, intuitive JSON payloads.
  • Instant Delivery Logs: Real-time log streaming with granular status codes, bounce categorization, and click tracking—no 15-minute dashboard delays.
  • Modern Developer Ergonomics: Modern typed SDKs for TypeScript, Python, Go, PHP, and Dart, plus native Model Context Protocol (MCP) support for AI.
  • Clean Identity Routing: Replace cumbersome SendGrid Subusers with lightweight Mailofly Sending Identities (account_key).

1. Payload Schema Comparison

SendGrid’s v3 /v3/mail/send payload requires deep nesting. Here is how it maps directly to Mailofly:

2. Code Migration Examples

Node.js / TypeScript


Python


Raw HTTP cURL

Notice the reduction in nesting and boilerplate:

3. SMTP Drop-in Cutover

If you use SendGrid via SMTP (such as in Laravel, Supabase, Ghost, WordPress, or Postfix), migration requires zero code changes—simply update your environment variables:

4. Migrating Suppressions & Unsubscribes

SendGrid maintains four suppression tables:
  1. Bounces: Mailboxes that permanently rejected mail.
  2. Spam Reports: Contacts who marked your mail as spam.
  3. Blocks: IPs or domains temporarily blocked.
  4. Global Unsubscribes: Contacts who opted out of all emails.

Export from SendGrid

In the SendGrid Dashboard:
  1. Go to Settings → Suppressions (or use the SendGrid Suppressions API: /v3/suppression/bounces, /v3/suppression/spam_reports, /v3/suppression/unsubscribes).
  2. Export each list as a CSV.

Import to Mailofly

  1. In Mailofly, go to Audiences > Contacts.
  2. Click Import Contacts.
  3. Upload your CSV and toggle Mark as Unsubscribed / Suppressed.
  4. Mailofly will automatically populate your global suppression blacklist, protecting your domain’s sending reputation.

5. Webhook Migration

SendGrid dispatches webhooks as an unauthenticated or signature-checked JSON array of events. Mailofly sends structured, single-event payloads cryptographically signed with HMAC / Svix.

Event Type Equivalents


6. Migration Checklist

  • Add domain to Mailofly and add mailofly._domainkey DKIM records.
  • Add include:mailofly.com to your existing SPF TXT record alongside SendGrid.
  • Export SendGrid Bounces, Spam Reports, and Unsubscribes, and import into Mailofly Suppressions.
  • Update SDK packages or environment variables (MAILOFLY_API_KEY, smtp.mailofly.com).
  • Set up Mailofly Webhook endpoints in your application.
  • Send test emails and verify click/open tracking on the Mailofly dashboard.
  • Decommission the SendGrid API key once traffic has completely transitioned.