Setup and Configuration
Configure Resend and Mailchimp for transactional emails and newsletter management
Configure both Resend (transactional emails) and Mailchimp (newsletters) by setting up API keys, DNS records, and environment variables.
Resend Setup
Create Resend Account
Sign up at Resend and access the dashboard.
Get API Key
Navigate to API Keys and generate a new key.
Configure DNS
Add your domain in Resend dashboard and copy the DNS records (DKIM, SPF, DMARC). Add these to your domain registrar and verify in Resend.
Add Environment Variable
| Env Variable | Type | Default |
|---|---|---|
RESEND_API_KEY | string | re_xxxx |
Mailchimp Setup
Create Mailchimp Account
Sign up at Mailchimp and access the dashboard.
Create Audience
Navigate to Audience → Create Audience and set up your newsletter list. Copy the Audience ID from Audience settings.
Get API Key
Go to Account → Extras → API Keys and create a new key. Note the server prefix (e.g., us6, us19) from the key.
Add Environment Variables
| Env Variable | Type | Default |
|---|---|---|
MAILCHIMP_API_KEY | string | - |
MAILCHIMP_API_SERVER | string | - |
MAILCHIMP_AUDIENCE_ID | string | - |
Environment Variables
Add all email-related variables to .env:
# Resend
RESEND_API_KEY="re_xxxx"
# Mailchimp
MAILCHIMP_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us19"
MAILCHIMP_API_SERVER="us6"
MAILCHIMP_AUDIENCE_ID="xxxxxxxxxx"Ensure .env is in .gitignore to protect API keys.
Verify Configuration
Run the development server to validate environment variables:
npm run devIf validation fails, check your API keys in the respective dashboards.
Client Initialization
Resend client is initialized in lib/resend/resend.ts:
import { env } from '@/env';
import { Resend } from 'resend';
export const resend = new Resend(env.RESEND_API_KEY);Mailchimp is accessed via API in app/api/resend/newsletter/route.ts using environment variables.
Next Steps
- Usage and Integration - Send emails and manage subscribers
- Troubleshooting - Common issues
How is this guide ?
Last updated on