Takazudo Modular Docs

Type to search...

to open search from anywhere

Email Service (Resend)

Email Service (Resend)

This document describes the email service setup for sending transactional emails (e.g., product availability notifications).

Status

ItemStatus
Resend accountCreated (takazudo@gmail.com)
Domain verificationVerified (DKIM, SPF, MX all green)
RegionTokyo (ap-northeast-1)
API keyCreated (takazudomodular-notify)
Netlify env varRESEND_API_KEY configured
Email forwardingnotify@takazudomodular.comtakazudo@gmail.com (Squarespace)
Auto-reply emailsImplemented (notify signup + reservation)
Batch email sendingImplemented (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

CriteriaDetails
Free tier3,000 emails/month (100/day)
Expected volume~100 emails/month
SDKTypeScript SDK with simple API
RegionTokyo (ap-northeast-1) for low latency
Japanese supportFull 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

VariableWherePurpose
RESEND_API_KEYNetlify env varsAPI key for sending emails
RESEND_API_KEYRoot .envLocal development (with netlify dev)

Domain Setup

The domain takazudomodular.com is verified on Resend with the following DNS records added to Squarespace:

TypeHostPurpose
TXTresend._domainkeyDKIM (domain verification)
MXsend (priority 10)SPF bounce handling (Amazon SES)
TXTsendSPF record for send subdomain
TXT_dmarcDMARC 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:

FromToService
notify@takazudomodular.comtakazudo@gmail.comSquarespace (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:

PlaceholderDescriptionAvailable in
{PRODUCT_NAME}Product display nameBoth
{USER_NAME}Customer’s nameReservation only
{PRODUCT_URL}Product page URLBoth

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

Source Files

FilePurpose
netlify/functions/shared/email.tsResend client, sendSingleEmail(), sendEmailBatch()
netlify/functions/shared/email-templates.tsTemplate CRUD, rendering, sendAutoReplyEmail()