← back to Trademarks Copyright
EMAIL_SETUP.md
74 lines
# Email Delivery Setup
Drops auto-picks the first configured backend — Resend → SMTP → file. To move to real email delivery:
## Recommended: Resend (fastest)
1. Sign up at [resend.com](https://resend.com) (free tier = 3,000/mo, 100/day — plenty for launch)
2. Add your sending domain + verify it
3. Create an API key with "Sending access"
4. Add to `.env.local`:
```
RESEND_API_KEY=re_...
DROPS_FROM="Drops <drops@yourdomain.com>"
```
5. Restart the launchd app: `launchctl unload/load ~/Library/LaunchAgents/com.steve.trademarks-copyright.plist`
## Alternative: SMTP (any provider)
Works with Mailgun, Postmark, Amazon SES, Google Workspace SMTP, or anything else.
```
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false # use true only for port 465
SMTP_USER=...
SMTP_PASS=...
DROPS_FROM="Drops <drops@yourdomain.com>"
```
Requires `nodemailer` — install with `npm install nodemailer` once (the send path imports it lazily so it's optional at build time).
## DNS records for deliverability
These make the difference between landing in the inbox vs. the spam folder. Even for Resend.
### SPF (required)
TXT record at your sending domain:
```
v=spf1 include:_spf.resend.com ~all
```
(For SMTP providers, use their `include:` directive instead.)
### DKIM (required)
Resend and most providers give you a CNAME to copy into DNS. For Resend:
```
resend._domainkey.yourdomain.com CNAME resend._domainkey.resend.com
```
### DMARC (strongly recommended)
TXT record at `_dmarc.yourdomain.com`:
```
v=DMARC1; p=none; rua=mailto:drops@yourdomain.com; pct=100
```
Start with `p=none` for 2 weeks of monitoring, then tighten to `p=quarantine`.
### MX (if you want replies to reach you)
Already set up on agentabrams.com (PurelyMail). If you use a different sending domain for Drops, make sure it has MX records so replies don't bounce.
## Verifying deliverability
1. Sign up with a Gmail address — should land in Inbox, not Promotions.
2. Sign up with an Outlook.com address — check the junk folder.
3. Run mail-tester.com's free check; target score ≥ 9/10.
4. Watch bounce rate in admin dashboard — anything over 2% is a deliverability issue.
## Current state
The `/api/health` endpoint reports the currently-selected backend:
- `file` → fallback / dev only (writes HTML to `/tmp/drops/`)
- `smtp` → nodemailer configured
- `resend` → Resend API configured
Rendered emails are tested against Gmail / Outlook / Apple Mail. If you need to tweak layout: `src/lib/drops.ts` → `renderDropHTML`.