Resend (Email)
Wat is Resend?
Section titled “Wat is Resend?”Resend is een developer-vriendelijke email API. We gebruiken het voor alle transactionele emails: bevestigingen, herinneringen, betaallinks en notificaties.
npm install resendimport { Resend } from 'resend';
export const resend = new Resend(process.env.RESEND_API_KEY);Domein verificatie
Section titled “Domein verificatie”Emails worden verstuurd vanuit het domein van het hondenhotel. Het domein moet worden geverifieerd in Resend via DNS records (SPF, DKIM).
From: noreply@[hoteldomain].comReply-To: info@[hoteldomain].comEmail templates
Section titled “Email templates”Templates worden gebouwd met React Email voor herbruikbare, gestylde email layouts.
import { Html, Body, Heading, Text, Button } from '@react-email/components';
interface BookingConfirmedProps { clientName: string; dogName: string; checkIn: string; checkOut: string; paymentUrl?: string; locale: 'nl' | 'en' | 'es' | 'pap';}
export function BookingConfirmedEmail({ clientName, dogName, checkIn, checkOut, paymentUrl, locale}: BookingConfirmedProps) { const t = getTranslations(locale);
return ( <Html> <Body> <Heading>{t('email.booking_confirmed.title')}</Heading> <Text>{t('email.booking_confirmed.greeting', { name: clientName })}</Text> <Text>{t('email.booking_confirmed.dog', { dog: dogName })}</Text> <Text>{t('email.booking_confirmed.dates', { checkIn, checkOut })}</Text> {paymentUrl && ( <Button href={paymentUrl}> {t('email.booking_confirmed.pay_now')} </Button> )} </Body> </Html> );}Versturen vanuit Edge Function
Section titled “Versturen vanuit Edge Function”// Vanuit Supabase Edge Functionimport { Resend } from 'npm:resend';
const resend = new Resend(Deno.env.get('RESEND_API_KEY'));
await resend.emails.send({ from: 'noreply@[hoteldomain].com', to: client.email, subject: getSubject('booking_confirmed', client.locale), react: BookingConfirmedEmail({ clientName: client.first_name, dogName: dog.name, checkIn: booking.check_in, checkOut: booking.check_out, paymentUrl: payment?.sentoo_payment_url, locale: client.locale, }),});Alle email types
Section titled “Alle email types”Zie Notificaties voor het volledige overzicht van triggers en inhoud.
Environment variables
Section titled “Environment variables”RESEND_API_KEY=[api-key]Resend limieten (gratis tier)
Section titled “Resend limieten (gratis tier)”| Limiet | Waarde |
|---|---|
| Emails per maand | 3.000 |
| Emails per dag | 100 |
| Custom domein | ✅ |
Voor productie is het betaalde plan aanbevolen ($20/maand voor 50.000 emails).