Resend
Sending email from an app through the Resend API: domain verification, React Email templates, idempotent sends.
IntegrationsUsing since 2023 · Featured project: Budzowska Fiutowski i Partnerzy
- Category
- Integrations
- Using since
- 2023
- Featured project
- Budzowska Fiutowski i Partnerzy
In practice
I pick Resend for the emails an application sends: confirmations and notifications from a form. On this site, in ENATIV Portfolio, one form submission sets off two emails. I do not start with a template but with the domain the email will leave from.
What is Resend?
Resend is an email-sending service with an API, made for developers. Email splits into transactional, meaning personalised messages triggered by an event, and campaigns, meaning bulk sends to a contact list. You can send only from a domain you own, added to the account and verified with DNS records, DKIM and SPF among them. A separate subdomain is better than the root domain.
From the application you use an SDK, for Node.js for example, and the body of the email can be a React Email component. Webhooks report delivery and bounces. A repeated send request is guarded by an idempotency key: repeat it within 24 hours and the email goes out only once. All of it fits in an ordinary API route of a Next.js app, with templates written in React.
- Kind
- An API for sending email
- Templates
- React Email components
How I work with Resend
I start with the domain and with what happens when an email fails to go out. The template comes after that. Resend ties deliverability to a verified domain, so that decides whether a message can arrive.
Domain and DNS records
I add the domain, preferably a subdomain for sending, and pass the DNS administrator the records from the Resend dashboard to copy exactly. Verification often takes fifteen minutes but can take up to 72 hours, so I do not leave it to launch day.
Templates in the repository
I write templates as React Email components and keep them in the repository next to the app, so a change of wording goes through review like code. In ENATIV Portfolio one route sends from them a notification to me in Polish and a confirmation to the visitor in their language.
Retries and the API key
I give every send an idempotency key, as in the contact route of ENATIV Portfolio, so a retried request does not send the email twice. In a server environment variable I keep the API key. I use no webhooks on this site. When an app has to react to a bounce, I connect a webhook.
When it fits, and when it doesn't
Resend fits apps that decide on their own when to send an email, with a body built from user data.
A good fit when
- Confirmations and notifications sent after an event in the app, such as a form submission.
- A React or Next.js project where templates should live in the repository next to the code.
- A company with its own domain and someone who can add DNS records to it.
- A team that wants to see the state of a send in a dashboard, not in server logs.
Not a fit when
- Ordinary company correspondence: that is a job for a mailbox, not an API.
- A company with no domain, or one that cannot change its DNS.
- An app with no backend, with nowhere to keep the API key.
When a company already has an email provider with a working verified domain, I stay with it, because a switch means verifying again and new settings. I put the sending in an API route, not in the browser.
Frequently asked questions
Should the app email its users?
Write which emails should go out, from which domain and who manages its DNS. I will answer what to set up before launch and whether Resend is enough.