# Resend setup recipe (primary send pipe)

Account exists, signup needs ONLY e-mail + password (no phone, no captcha wall in Camoufox+WARP): mail.tm address for signup, confirmation link fetched via mail.tm API. Key with Full access in `~/.secrets/resend.json` (`resend_api_key`). Free tier: ~100 mails/day.

## Add a new project domain (one-time per domain)

1. `POST https://api.resend.com/domains` `{"name": "projekt.tld"}` → response contains `id` + 4 records:
   - DKIM TXT: `resend._domainkey` → `p=...` (long RSA key, quote it in the zone file)
   - SPF MX: `send` → `feedback-smtp.us-east-1.amazonses.com.` priority 10
   - SPF TXT: `send` → `"v=spf1 include:amazonses.com ~all"`
   - CNAME: `rsend` → `send.forge.rmta.net.`
2. Append all 4 to the project's bind9 zone (`/etc/bind/db.<domain>`): sudo python for multi-line edits, bump the serial, `named-checkzone`, `rndc reload <zone>`. The zone stays on the main VPS even when the site lives elsewhere.
3. `POST /domains/<id>/verify` (empty JSON body), then poll `GET /domains/<id>` until every record shows `verified` — CNAME verifies within a minute, TXT/MX can take a few minutes; re-fire verify after ~60 s if stuck at pending. Check `dig @8.8.8.8` first if verification stalls: if the record resolves publicly, Resend's checker just needs another poll.
4. Send test as `Projekt <info@projekt.tld>` to a mail.tm account, confirm receipt via mail.tm API before declaring done.

## Send call (works from any VPS, port 443)

```
POST https://api.resend.com/emails
Authorization: Bearer <resend_api_key>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0
Content-Type: application/json

{"from": "Projekt <info@projekt.tld>", "to": ["ziel@example.com"],
 "reply_to": "info@projekt.tld", "subject": "...", "text": "..."}
```

The `User-Agent` header is MANDATORY: without it Cloudflare returns `403, error code: 1010`. `reply_to` (snake_case in Resend API, not `replyTo`).
