Email Service (Resend)
Email Service (Resend)
This document describes the email service setup for sending transactional emails (e.g., product availability notifications).
Status
| Item | Status |
|---|---|
| Resend account | Created (takazudo@gmail.com) |
| Domain verification | Verified (DKIM, SPF, MX all green) |
| Region | Tokyo (ap-northeast-1) |
| API key | Created (takazudomodular-notify) |
| Netlify env var | RESEND_API_KEY configured |
| Email forwarding | notify@takazudomodular.com → takazudo@gmail.com (Squarespace) |
| Auto-reply emails | Implemented (notify signup + reservation) |
| Batch email sending | Implemented (admin notify send) |
Overview
We use Resend as the email sending service. Resend provides a modern API for transactional emails with a generous free tier suitable for our volume.
Why Resend
| Criteria | Details |
|---|---|
| Free tier | 3,000 emails/month (100/day) |
| Expected volume | ~100 emails/month |
| SDK | TypeScript SDK with simple API |
| Region | Tokyo (ap-northeast-1) for low latency |
| Japanese support | Full UTF-8 support for subject and body |
SendGrid was originally considered but discontinued its free tier in May 2025. Netlify Email Integration is not a native email service — it’s a wrapper around third-party providers (Mailgun, Postmark, SendGrid). Resend offers a simpler direct integration.
Configuration
Environment Variables
| Variable | Where | Purpose |
|---|---|---|
RESEND_API_KEY | Netlify env vars | API key for sending emails |
RESEND_API_KEY | Root .env | Local development (with netlify dev) |
Domain Setup
The domain takazudomodular.com is verified on Resend with the following DNS records added to Squarespace:
| Type | Host | Purpose |
|---|---|---|
| TXT | resend._domainkey | DKIM (domain verification) |
| MX | send (priority 10) | SPF bounce handling (Amazon SES) |
| TXT | send | SPF record for send subdomain |
| TXT | _dmarc | DMARC policy (v=DMARC1; p=none;) |
These records use the send subdomain, which avoids conflicts with the existing Mailgun MX records used by Squarespace email forwarding on @.
Email Forwarding (Receiving)
Squarespace email forwarding is configured separately for receiving replies:
| From | To | Service |
|---|---|---|
notify@takazudomodular.com | takazudo@gmail.com | Squarespace (Mailgun) |
This uses the MX records on @ (mxa.mailgun.org, mxb.mailgun.org), which coexist with Resend’s records on the send subdomain.
Usage
Auto-Reply Emails
Auto-reply emails are sent automatically when users submit “Notify Me” or “Reservation” forms. Templates are managed via the zpreorder admin interface.
See netlify/functions/shared/email-templates.ts for the implementation:
import { sendAutoReplyEmail } from './shared/email-templates.js';
await sendAutoReplyEmail({
templateKey: 'notify', // or 'reservation'
to: email,
variables: {
PRODUCT_NAME: productName,
PRODUCT_URL: productUrl ?? 'https://takazudomodular.com',
},
logPrefix: 'notify-signup',
});
Available template placeholders:
| Placeholder | Description | Available in |
|---|---|---|
{PRODUCT_NAME} | Product display name | Both |
{USER_NAME} | Customer’s name | Reservation only |
{PRODUCT_URL} | Product page URL | Both |
Single Email Sending
For sending a single email directly (used internally by auto-reply):
import { sendSingleEmail } from './shared/email.js';
const result = await sendSingleEmail(
'subscriber@example.com',
'VCO-1 入荷のお知らせ',
'VCO-1が入荷しました。',
);
Plain text body is automatically converted to HTML with a consistent footer template.
Batch Email Sending (Admin)
The admin-notify-send Netlify Function uses sendEmailBatch() to send product availability notifications to multiple subscribers. See Admin Notify Send for the API specification.
Batch processing details:
- Send emails in batches of 10 to respect rate limits
- 1 second delay between batches
- Track successful/failed sends individually
- Update subscriber status to “notified” after successful send
DNS Architecture
takazudomodular.com DNS (Squarespace)
├── @ (root domain)
│ ├── MX → mxa.mailgun.org (Squarespace email forwarding - RECEIVING)
│ ├── MX → mxb.mailgun.org (Squarespace email forwarding - RECEIVING)
│ ├── TXT → v=spf1 include:mailgun.org ~all (Mailgun SPF)
│ └── TXT → mailo._domainkey DKIM (Mailgun DKIM)
├── send (subdomain)
│ ├── MX → feedback-smtp.ap-northeast-1.amazonses.com (Resend - SENDING)
│ └── TXT → v=spf1 include:amazonses.com ~all (Resend SPF)
├── resend._domainkey
│ └── TXT → DKIM key (Resend domain verification)
└── _dmarc
└── TXT → v=DMARC1; p=none; (DMARC policy)
Resend Dashboard
- Dashboard: https://resend.com/overview
- API Keys: https://resend.com/api-keys
- Domains: https://resend.com/domains
- Logs: https://resend.com/logs (view sent/failed emails)
Source Files
| File | Purpose |
|---|---|
netlify/functions/shared/email.ts | Resend client, sendSingleEmail(), sendEmailBatch() |
netlify/functions/shared/email-templates.ts | Template CRUD, rendering, sendAutoReplyEmail() |
Related
- Admin Notify Send - API endpoint that triggers batch email sending
- Webhook Notifications - Slack and Discord webhook integration
- Blob Storage - Where notification history and email templates are stored