SendGrid is the largest email API by volume — Twilio-owned, used by Uber, Airbnb, Spotify. Designed for scale: sub-accounts, dedicated IPs, IP warmup, marketing + transactional in one product. The trade-off is heavier UI and pricier mid-volume tiers.
Sign up at signup.sendgrid.com ↗. The free tier is 100 emails/day forever after the 60-day trial; paid plans start at $19.95/mo for 50K emails.
SendGrid's signup process includes account verification — they sometimes ask follow-up questions for new accounts to fight abuse. Be patient.
Two options:
For Domain Authentication: Settings → Sender Authentication → Authenticate Your Domain. Pick your DNS host; SendGrid generates 3 CNAME records:
em1234.yourdomain.com → SendGrid's mail servers1._domainkey.yourdomain.com → DKIM record 1s2._domainkey.yourdomain.com → DKIM record 2Add at your DNS provider; come back to SendGrid and click Verify. Usually green in 10–30 minutes.
Settings → API Keys → Create API Key. Pick:
Copy the key (starts with SG.). Shown once. Store in env:
SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
npm install @sendgrid/mail
Other languages: Python, Ruby, PHP, Java, C#, Go ↗.
import sgMail from "@sendgrid/mail";
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
await sgMail.send({
to: "[email protected]",
from: "[email protected]", // must be a verified sender
subject: "Hello from SendGrid",
text: "Plain text version",
html: "<p>HTML body</p>",
});
Check your recipient. If it's not there, look at Activity in the SendGrid dashboard — every send is logged with its delivery status and the recipient mail server's response.
For repeatable emails (welcome, receipt, password reset), use Dynamic Templates — designed in the SendGrid dashboard, sent by ID.
Email API → Dynamic Templates → Create Template. Use the drag-and-drop editor or HTML editor. Variables look like {{name}} using Handlebars syntax.
Send by template ID:
await sgMail.send({
to: user.email,
from: "[email protected]",
templateId: "d-xxxxxxxxxxxxxxxxxxxxxxxx", // starts with d-
dynamicTemplateData: {
name: user.name,
verifyUrl: `https://yourapp.com/verify/${token}`,
},
});
Editing the template in the dashboard updates all future sends immediately — no deploy needed.
Settings → Mail Settings → Event Webhook. Add your endpoint URL. Pick events: delivered, opened, clicked, bounced, dropped, spam reported.
SendGrid POSTs your URL with batches of events. Enable signed event webhooks for security — SendGrid signs the payload with a key you verify on your end. Signed webhook docs ↗.
What to do with the events:
Shared IPs are the default on free / starter plans. At higher volume you can request a dedicated IP — but a new IP has no sending reputation. You need to "warm it up" by gradually increasing volume over 4–6 weeks.
SendGrid automates this: enable IP warmup in account settings; SendGrid throttles your sends to safe daily limits that ramp up over time. Skip the warmup and you'll land in spam everywhere.
IP warmup schedule ↗. For volumes under ~100K/month, the shared IP pool is fine.
SendGrid's Subusers feature lets a single SendGrid account own multiple sub-accounts with their own API keys, sender authentication, and IP pools. Useful when you have multiple products or run a multi-tenant platform.
Settings → Subuser Management. Create a subuser with its own credentials; assign IP pools and limits. Subusers docs ↗.
Most indie/SaaS users don't need this. Pick a different provider if you're not at the scale that justifies a multi-account hierarchy.
Free: 100 emails/day forever (after a 60-day 40K/month trial). Essentials: $19.95/mo for 50K emails. Pro: $89.95/mo for 100K + dedicated IP. SendGrid pricing ↗.
Per-email cost is competitive at scale ($0.0004 / email at the millions-per-month tier). For < 50K/month, Resend is cheaper for the same DX.