DEV Community

Alex Spinov
Alex Spinov

Posted on

Resend Has a Free API — Send Transactional Emails in 3 Lines of Code

Email Should Not Be This Hard

Resend gives you email in 3 lines. Free tier: 3000 emails/month.

JavaScript

import { Resend } from "resend";
const resend = new Resend("re_your_api_key");

const { data } = await resend.emails.send({
  from: "hello@yourdomain.com",
  to: "user@example.com",
  subject: "Welcome!",
  html: "<h1>Welcome</h1>"
});
Enter fullscreen mode Exit fullscreen mode

Python

import resend
resend.api_key = "re_your_api_key"

email = resend.Emails.send({
    "from": "hello@yourdomain.com",
    "to": ["user@example.com"],
    "subject": "Welcome!",
    "html": "<h1>Welcome</h1>"
})
Enter fullscreen mode Exit fullscreen mode

cURL

curl -X POST https://api.resend.com/emails \
  -H "Authorization: Bearer re_your_api_key" \
  -H "Content-Type: application/json" \
  -d "{\"from\":\"hello@yourdomain.com\",\"to\":[\"user@example.com\"],\"subject\":\"Test\",\"html\":\"Hello\"}"
Enter fullscreen mode Exit fullscreen mode

Comparison

Service Free Tier Setup
Resend 3000/mo 5 min
SendGrid 100/day 30 min
AWS SES 62K/mo (EC2) 2 hours
Mailgun 1000/mo 15 min

Use Cases

  1. Welcome emails on signup
  2. Password reset flows
  3. Order confirmations
  4. Alert notifications
  5. Weekly digest emails

More | GitHub


More from me: 10 Dev Tools I Use Daily | 77 Scrapers on a Schedule | 150+ Free APIs

Top comments (0)