Skip to content

Email for professionals and teams

update readme

Hieu Nguyen (Jack)7855251cdd0c
diff --git a/.dev.vars.example b/.dev.vars.example
index 1a5a6fd..b9ea97d 100644
--- a/.dev.vars.example
+++ b/.dev.vars.example
@@ -12,3 +12,12 @@ CF_TOKEN=your_api_token_with_zone_email_permissions
# The Worker uses the AI binding in wrangler.jsonc. Override its chat/draft model if needed.
# AI_MODEL=@cf/moonshotai/kimi-k2.5
+
+# Optional: send and receive through Resend or Amazon SES instead of Cloudflare.
+# These can also be entered in Admin > Domains; values saved there take precedence.
+# RESEND_API_KEY=re_...
+# AWS_ACCESS_KEY_ID=AKIA...
+# AWS_SECRET_ACCESS_KEY=your_secret_access_key
+# AWS_REGION=us-east-1
+# Receiving through Resend or SES needs a public HTTPS address.
+# APP_URL=https://mail.example.com
diff --git a/README.md b/README.md
index 9be9f32..72ded99 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
# Mailflare
-Mailflare is a self-hosted email inbox for custom domains, built on Cloudflare.
+Mailflare is a self-hosted email inbox for custom domains, built on Cloudflare. Receive and send mail with Cloudflare Email Routing and Email Sending, **Resend**, or **Amazon SES**, chosen per domain.
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/hieunc229/mailflare)
@@ -23,7 +23,7 @@ Want to support the mailflare? <a target="_blank" href="https://store.paymug.co/
## What you can do
-- **Domain setup**: Connect domains and set up Cloudflare Email Routing from the dashboard.
+- **Domain setup**: Connect Cloudflare-managed domains and, for each one, choose what receives and what sends its mail: Cloudflare, Resend, or Amazon SES. Mailflare creates the DNS and the provider resources from the dashboard.
- **Mailboxes**: Create personal and shared mailboxes with delegated access.
- **Email**: Send and receive email with attachments, rich formatting, signatures, and automatic replies.
- **Inbox organization**: Organize mail with search, custom folders, stars, snoozing, archive, spam, and trash.
@@ -36,13 +36,13 @@ Want to support the mailflare? <a target="_blank" href="https://store.paymug.co/
## How it works
-Mailflare runs in your Cloudflare account. Email Routing delivers incoming messages to the app, while Cloudflare's email service handles outgoing messages. Your mail data stays in your own D1 database and attachments are stored in your own R2 bucket.
+Mailflare runs in your Cloudflare account. By default Email Routing delivers incoming messages to the app, while Cloudflare's email service handles outgoing messages. Each domain can instead receive through Resend or Amazon SES, send through either, or do both through different providers; Cloudflare keeps managing the domain's DNS. Your mail data stays in your own D1 database and attachments are stored in your own R2 bucket, whichever provider carries it. See [Sending and receiving providers](docs/providers.md).
## How much does it cost?
You can setup Mailflare and receive email for free
-A [Paid Worker](https://developers.cloudflare.com/workers/platform/pricing/) plan ($5/month) is required to send email (and it's recommend to have a smooth experience)
+A [Paid Worker](https://developers.cloudflare.com/workers/platform/pricing/) plan ($5/month) is required to send email with Cloudflare (and it's recommend to have a smooth experience). Sending through Resend or Amazon SES is billed by those services instead.
## Deploy
@@ -50,7 +50,7 @@ Getting started takes three steps:
1. **Deploy the app.** Click **Deploy to Cloudflare** and keep the app name as `mailflare`. The app will not work correctly under another Worker name.
2. **Complete setup.** Open the deployed app and follow `/setup` to check the installation and create your admin account.
-3. **Connect your domain.** Add a domain managed by the same Cloudflare account. Mailflare configures its email routing and helps you create the first mailbox.
+3. **Connect your domain.** Add a domain managed by the same Cloudflare account and choose which service receives its mail. Mailflare configures Email Routing, or helps you set up Resend or Amazon SES, and helps you create the first mailbox. Add Resend or AWS credentials from the domain page when you want to use them.
⚠️ IMPORTANT: **`CF_TOKEN` is required during deployment**. Create a scoped [Cloudflare API token with the following permissions](https://github.com/hieunc229/mailflare/issues/24#issuecomment-5523686105) for the domains you want to connect.
- All accounts - Email Sending:Edit, DNS Settings:Edit, Email Routing Addresses:Edit
@@ -86,7 +86,7 @@ See the [deployment guide](docs/deployment.md) for required permissions, manual
### Self-host with Docker instead
-Mailflare also runs as one container on any server, with SQLite and local files in place of D1 and R2, a built-in SMTP listener for inbound mail (or a small Cloudflare relay Worker if you want to keep MX on Cloudflare), and any SMTP relay or Cloudflare Email Sending for outbound.
+Mailflare also runs as one container on any server, with SQLite and local files in place of D1 and R2, a built-in SMTP listener for inbound mail (or a small Cloudflare relay Worker if you want to keep MX on Cloudflare), and any SMTP relay, Cloudflare Email Sending, Resend or Amazon SES for outbound.
```bash
cp .env.docker.example .env.docker
@@ -113,6 +113,7 @@ The Cloudflare app uses vinext and the Cloudflare Vite plugin, including local D
## Documentation
- [Deployment and configuration](docs/deployment.md)
+- [Sending and receiving providers (Cloudflare, Resend, Amazon SES)](docs/providers.md)
- [API and integrations](docs/api.md)
- [Email assistant and MCP](docs/email-assistant-and-mcp.md)
- [Troubleshooting](docs/troubleshooting.md)
diff --git a/docs/api.md b/docs/api.md
index bf9592a..bcf55c9 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -4,7 +4,7 @@ Mailflare exposes APIs for domain, account, and mailbox management, and for send
## Domain management
-Adding or removing a domain from Mailflare also updates Cloudflare Email Routing and sending resources.
+Adding or removing a domain from Mailflare also updates Cloudflare Email Routing and sending resources. Each domain has a `sendingProvider` and a `receivingProvider` (`none`, `cloudflare`, `resend` or `ses`); see [Sending and receiving providers](providers.md).
| Mailflare route | Purpose |
| --- | --- |
@@ -13,6 +13,14 @@ Adding or removing a domain from Mailflare also updates Cloudflare Email Routing
| `GET /api/domains/[id]` | Get a connected domain |
| `DELETE /api/domains/[id]` | Remove a domain and clean up its Cloudflare resources |
| `GET /api/domains/[id]/dns` | View its routing and sending DNS status |
+| `PUT /api/domains/[id]/sending` | Choose the sending provider (`{ provider: "none" \| "cloudflare" \| "resend" \| "ses" }`) |
+| `PUT /api/domains/[id]/receiving` | Choose the receiving provider (same values) |
+| `GET /api/domains/[id]/sending`, `GET /api/domains/[id]/receiving` | Which providers still have configuration for the domain |
+| `DELETE /api/domains/[id]/sending`, `DELETE /api/domains/[id]/receiving` | Remove an unselected provider's configuration (`{ target }`) |
+| `GET/POST /api/domains/[id]/resend`, `/api/domains/[id]/ses` | Sending status, setup, verify and test email for Resend or SES |
+| `GET/POST /api/domains/[id]/receiving/[provider]` | Receiving checklist and setup for `resend` or `ses`; `POST` also accepts `cloudflare`, and answers `409 MX_CONFLICT` with the records until called with `{ replaceMx: true }` |
+| `GET/PUT/DELETE /api/admin/resend-key` | The shared Resend API key (primary administrator) |
+| `GET/PUT/POST/DELETE /api/admin/aws` | The shared AWS credentials: `PUT` validates before saving and `POST` re-checks permissions (primary administrator) |
The hostname must be the apex of a zone available to the configured Cloudflare credentials, or a subdomain of that zone. Creating a mailbox also creates the Cloudflare Email Routing rule that delivers its address to the `mailflare` Worker.
@@ -23,7 +31,7 @@ The same operations are available to scripts through admin API keys with the `do
| Mailflare route | Purpose |
| --- | --- |
| `GET /api/v1/domains` | List connected domains with their DNS status |
-| `POST /api/v1/domains` | Connect a domain and configure Cloudflare (`{ hostname, enableRouting?, enableSending?, replaceMxRecords? }`) |
+| `POST /api/v1/domains` | Connect a domain and configure Cloudflare (`{ hostname, enableRouting?, enableSending?, replaceMxRecords?, receivingProvider? }`; `receivingProvider` defaults to `cloudflare`, and with another value Email Routing is not enabled) |
| `GET /api/v1/domains/[id]` | Get a connected domain |
| `DELETE /api/v1/domains/[id]` | Remove a domain and clean up its Cloudflare resources |
| `GET /api/v1/domains/[id]/dns` | View its routing, sending and authentication DNS status |
@@ -31,6 +39,16 @@ The same operations are available to scripts through admin API keys with the `do
`GET /api/v1/domains` returns `{ domains, dns }`, where `dns[id].auth` reports `ok` / `missing` / `unknown` for MX, SPF, DKIM and DMARC. `GET /api/v1/domains/[id]/dns` returns the full audit, including the names queried and the values found. The `setup` route provisions MX/SPF through Email Routing, DKIM through the sending subdomain, and a `v=DMARC1; p=none` TXT for DMARC; on a self-hosted install where DNS is managed manually it returns an error, since Mailflare cannot write the zone.
+### Inbound provider endpoints
+
+Resend and Amazon SES deliver mail by calling the app, so these routes are public and authenticate themselves rather than using a session or API key:
+
+| Route | Authenticated by |
+| --- | --- |
+| `POST /api/inbound/resend` | The Svix signature of the webhook secret Resend returned when Mailflare created the webhook |
+| `POST /api/inbound/ses?token=…` | The secret token in the subscription URL, the SNS topic ARN, and reading the message from the account's own S3 bucket |
+| `POST /api/inbound` | The HMAC from the Cloudflare relay Worker, used by self-hosted installs ([self-hosting](self-hosting.md)) |
+
## Account and mailbox management
Admin > API keys can also grant the `accounts` and `mailboxes` scopes independently. These routes use `Authorization: Bearer <key>` and require the key owner to retain the admin role. Account management requires a Team license; creating a shared mailbox also requires a Team license. Each key can access only accounts created by its owner and mailboxes owned by those accounts or the admin.
@@ -129,7 +147,7 @@ To send a reply that threads correctly in the recipient's client, pass the paren
Messages composed in Mailflare are sent as HTML with a plain-text alternative derived from it. Quoted or forwarded content is wrapped in `<div class="mailflare-quote" data-mailflare-quote="1">` so the reader can fold it. `POST /api/drafts` accepts `forwardOfMessageId`, which copies that message's attachments onto the new draft; `DELETE /api/drafts/{id}/attachments/{attachmentId}` removes one, and `POST /api/send` with `draftId` sends the draft's stored files along with any uploaded in the request.
The dashboard composer accepts up to 10 attachments. An administrator sets the outgoing per-file and combined limit from 1 to 25 MB on **General** (`/general`); the default is 25 MB. Attachment metadata is stored in D1 and file content is stored in R2. Normal message downloads require access to the mailbox containing the message.
-Cloudflare Email Sending limits the entire encoded message, including attachments, to 5 MiB for general recipients, or 25 MiB for verified destination addresses. To stay under the general limit, files over 3 MB and smaller files that would exceed the message budget are sent as R2 download links. The recipient can download them for 30 days; anyone with the link can access the file during that time. The outgoing cap still applies to those files. Cloudflare also limits recipient count to 50, subject length to 998 characters, and headers to 16 KB.
+The limits below apply to domains that send through Cloudflare. Resend and Amazon SES take attachments directly, within the same administrator limit. Cloudflare Email Sending limits the entire encoded message, including attachments, to 5 MiB for general recipients, or 25 MiB for verified destination addresses. To stay under the general limit, files over 3 MB and smaller files that would exceed the message budget are sent as R2 download links. The recipient can download them for 30 days; anyone with the link can access the file during that time. The outgoing cap still applies to those files. Cloudflare also limits recipient count to 50, subject length to 998 characters, and headers to 16 KB.
Incoming mail that exceeds the attachment count or 25 MB decoded attachment limit is rejected during delivery, so the sender's mail provider can report a delivery failure. Cloudflare Email Routing also limits the entire raw message to 25 MiB, including MIME encoding, and may reject it before Mailflare runs.
## JMAP
diff --git a/docs/deployment.md b/docs/deployment.md
index 698e90e..d1349fa 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -8,7 +8,7 @@ Set up Mailflare in three steps:
1. **Deploy the app:** use the Deploy to Cloudflare button, set the app name to `mailflare`, and provide the required `CF_TOKEN`.
2. **Complete setup:** open the deployed app and follow `/setup` to check the installation and create the first admin account.
-3. **Connect your domain:** add a domain managed by the same Cloudflare account. Mailflare configures email routing and, when available and selected, email sending before helping you create the first mailbox.
+3. **Connect your domain:** add a domain managed by the same Cloudflare account and choose which service receives its mail. Mailflare configures email routing and, when available and selected, email sending before helping you create the first mailbox. Resend and Amazon SES are alternatives to Cloudflare for receiving and sending; see [Sending and receiving providers](providers.md).
## Step 1: Setup CF_TOKEN
@@ -59,7 +59,9 @@ Setup applies the committed migrations through the Worker's D1 binding before cr
3. Choose the address for your first mailbox and finish setup.
4. Open the inbox and send a test message to the new address.
-To connect more domains later, open **Admin → Domains**, select **New domain**, and enter the hostname. Mailflare configures Email Routing and Email Sending automatically.
+To connect more domains later, open **Admin → Domains**, select **New domain**, enter the hostname and choose the receiving service. With Cloudflare, Mailflare configures Email Routing and Email Sending automatically. With Resend or Amazon SES, add the provider's credentials and run its setup from the domain page; see [Sending and receiving providers](providers.md). The `CF_TOKEN` is still needed in every case, because Cloudflare manages the domain's DNS.
+
+Resend and SES receive mail by calling your app, so set `APP_URL` to the app's public HTTPS address before setting them up for receiving.
Your inbox should be ready to send and receive emails
diff --git a/docs/providers.md b/docs/providers.md
new file mode 100644
index 0000000..b15f382
--- /dev/null
+++ b/docs/providers.md
@@ -0,0 +1,96 @@
+# Sending and receiving providers
+
+Mailflare keeps your mail data in your own D1 database and R2 bucket (or SQLite and local files when self-hosted). What carries mail over the wire is a choice you make **per domain**, separately for receiving and for sending:
+
+| | Cloudflare | Resend | Amazon SES |
+|---|---|---|---|
+| **Receiving** | Email Routing (the default) | `email.received` webhook | S3 + SNS notification |
+| **Sending** | Cloudflare Email Sending | Resend API | SESv2 API |
+
+DNS stays on Cloudflare for every combination: Mailflare writes the records for whichever provider you pick. A domain can also be **receive-only** (sending: Not selected) or **send-only** (receiving: Not selected).
+
+Open **Admin → Domains**, expand a domain, and use the **Setup receiving email** and **Setup sending email** sections. Each provider is a card with a switch. Turning a switch on selects that provider and shows its setup; the icon on the left is a green check when it is fully set up and an amber triangle when it is not.
+
+> Selecting a provider does not change DNS. The Setup button inside the provider's card does. This lets you prepare a new provider while the old one keeps working.
+
+## Choosing at add time
+
+**New domain** asks which service receives the domain's mail. Cloudflare Email Routing is enabled on the zone only when you pick Cloudflare. For Resend or SES the domain is added without touching Email Routing; finish from the domain page once the credentials are in. The same choice is available over the API as `receivingProvider` (see [API](api.md#domain-management)).
+
+## Resend
+
+Resend uses one **API key**, shared by every domain that uses it. Create it at [resend.com/api-keys](https://resend.com/api-keys).
+
+- A **full-access** key lets Mailflare add the domain to Resend, write its DNS records to the Cloudflare zone, verify it, and (for receiving) register the webhook.
+- A **sending-only** key can send, but Resend refuses it for domain and webhook management, so you add the domain at [resend.com/domains](https://resend.com/domains), create its records yourself, and use **Send test email** to confirm. Mailflare says so in the card instead of failing.
+
+The key is checked against Resend when you save it. It can also come from the `RESEND_API_KEY` secret, which is used when no key is saved in the app. Only the primary administrator can change it.
+
+**Sending.** Setup creates the domain in Resend, publishes its DKIM and SPF records, and asks Resend to verify. Verification is Resend's own status: it can stay `pending` for a few minutes after the DNS is added, and **Check status** re-asks Resend without creating anything new. Replies thread correctly because Mailflare sets its own `Message-ID`.
+
+**Receiving.** Setup enables the receiving capability on the domain, points the apex MX at Resend, and registers one webhook for `email.received` at `/api/inbound/resend`. The webhook is authenticated with the Svix signing secret Resend returns when it is created; Mailflare stores that secret, which is why a webhook it did not create itself is replaced. For each event Mailflare fetches the message, downloads the raw MIME and runs it through the normal inbound pipeline. Resend must be able to reach your app, so `APP_URL` has to be a public HTTPS address.
+
+## Amazon SES
+
+Create an IAM user with programmatic access, then enter its **access key ID**, **secret access key** and **region** in the SES card. Mailflare validates them before saving: it proves the identity with STS, then makes a harmless call to each service it needs, and lists every permission the key lacks. Credentials can also come from `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION`.
+
+The key needs this policy (the card shows it too, with only the missing parts called out):
+
+```json
+{
+ "Version": "2012-10-17",
+ "Statement": [
+ { "Effect": "Allow", "Action": ["sts:GetCallerIdentity", "ses:GetAccount", "ses:SendEmail", "ses:CreateEmailIdentity", "ses:GetEmailIdentity", "ses:DeleteEmailIdentity"], "Resource": "*" },
+ { "Effect": "Allow", "Action": ["ses:DescribeActiveReceiptRuleSet", "ses:CreateReceiptRuleSet", "ses:SetActiveReceiptRuleSet", "ses:CreateReceiptRule", "ses:UpdateReceiptRule", "ses:DescribeReceiptRule", "ses:DeleteReceiptRule"], "Resource": "*" },
+ { "Effect": "Allow", "Action": ["sns:ListTopics", "sns:CreateTopic", "sns:SetTopicAttributes", "sns:Subscribe", "sns:ListSubscriptionsByTopic"], "Resource": "*" },
+ { "Effect": "Allow", "Action": ["s3:ListAllMyBuckets", "s3:CreateBucket", "s3:PutBucketPolicy", "s3:PutLifecycleConfiguration", "s3:ListBucket", "s3:GetObject", "s3:DeleteObject"], "Resource": "*" }
+ ]
+}
+```
+
+Only the sending statements are needed if you use SES just for sending.
+
+**Sending.** Setup creates the domain's SES identity, publishes its three DKIM CNAME records to the Cloudflare zone, and tracks verification. New AWS accounts start in the **SES sandbox**, where SES delivers only to verified addresses; Mailflare shows a warning row until you request production access in the SES console. Replies thread because Mailflare stores the Message-ID SES assigns (`<[email protected]>` in us-east-1, `<[email protected]>` elsewhere).
+
+**Receiving.** SES can only receive in some regions (for example us-east-1, us-west-2 and eu-west-1); Mailflare rejects the others. Setup creates, idempotently:
+
+1. an S3 bucket (`mailflare-inbound-<account>-<region>`) that only SES may write to, with a one-day expiry for leftovers (best effort);
+2. an SNS topic that only SES may publish to, subscribed to `/api/inbound/ses` with a secret token in the URL;
+3. a receipt rule for the domain in the account's active rule set (Mailflare creates and activates `mailflare-inbound` only if the account has none, and otherwise adds its rule beside yours);
+4. the MX record `inbound-smtp.<region>.amazonaws.com`.
+
+Each message is read from your own bucket, handed to the normal inbound pipeline, and deleted. SES's virus scan is enabled and infected messages are dropped. `APP_URL` has to be a public HTTPS address so SNS can reach the endpoint. The bucket and topic are shared by all SES domains; **Clean up** removes only the domain's rule and MX, so Mailflare never deletes resources another domain may still use.
+
+## MX records and switching receiving provider
+
+Only one service can own a domain's MX records. When a provider's Setup finds MX records for something else (including Cloudflare Email Routing's), it stops and shows them, and replaces them only after you confirm. Confirming means the previous service stops receiving mail for that domain.
+
+Per-address routes to the Mailflare Worker are only created for domains that receive through Cloudflare, and are recreated when you set Cloudflare up again.
+
+## Cleaning up the provider you left
+
+If a provider you are not using still has configuration for the domain, its card shows **Clean up**:
+
+- **Cloudflare sending** deletes the zone's sending subdomain and its DNS.
+- **Cloudflare receiving** deletes the domain's routing rules and MX, and disables Email Routing on the zone when no other domain uses it.
+- **Resend** deletes the domain from Resend and its DNS records. If the domain still receives (or sends) through Resend, only the capability you are leaving is switched off.
+- **SES sending** deletes the identity and its DKIM records.
+- **SES receiving** deletes the domain's receipt rule and MX.
+
+You cannot clean up the provider that is currently selected.
+
+## Behavior that differs from Cloudflare
+
+- **Routing rules.** Reject and forward rules need to act on the live SMTP session, which only Cloudflare's email handler can do. For mail received through Resend or SES, a reject rule drops the message and forward rules are not applied. Store and categorize rules, mailbox rules, spam handling and webhooks work as usual.
+- **Attachments.** Cloudflare sends large files as R2 download links to stay under its 5 MiB limit. Resend and SES send attachments directly, within the administrator's outgoing limit (up to 25 MB).
+- **Size.** Inbound mail from any provider is capped at 25 MiB and the same attachment limits apply; larger messages are dropped.
+
+## Configuration reference
+
+| Variable | Purpose |
+|---|---|
+| `RESEND_API_KEY` | Resend key used when none is saved in the app |
+| `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` | SES credentials used when none are saved in the app |
+| `APP_URL` | Public HTTPS address; required for Resend and SES receiving, because the providers call this app |
+
+Settings saved in the app take precedence over these variables. Keys saved in the app are stored as plain text in the `app_settings` table (as the AI provider key already is), so protect database backups accordingly.
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index eff94fc..5b97d1e 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -56,6 +56,15 @@ certificate on a private network.
Sending: Edit. The domain must be a Cloudflare zone with Email Sending set
up; Mailflare calls the REST API, no Workers plan needed.
+**Resend or Amazon SES, per domain.** Instead of one global relay, each domain
+can send through Resend or SES with their APIs (no SMTP involved), and receive
+through them too, once Mailflare can manage the domain's DNS with `CF_TOKEN`.
+Add the credentials on the domain page, or set `RESEND_API_KEY` /
+`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION`. Receiving
+through either needs `APP_URL` set to your public HTTPS address. See
+[Sending and receiving providers](providers.md). Using SES as a plain SMTP
+relay through `SMTP_URL`, described above, still works and needs none of this.
+
## Cloudflare zone management (optional)
If `CF_TOKEN` can also edit DNS and Email Routing on your zones, adding a
@@ -77,6 +86,8 @@ and the DNS page shows what to set by hand.
| `SMTP_URL` | unset | Outbound relay |
| `SMTP_TLS_REJECT_UNAUTHORIZED` | `true` | Trust self-signed relay certificates when `false` |
| `CF_ACCOUNT_ID`, `CF_TOKEN` | unset | Cloudflare Email Sending, and zone management if the token allows |
+| `RESEND_API_KEY` | unset | Resend key, used when none is saved in the app |
+| `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` | unset | Amazon SES credentials, used when none are saved in the app |
| `INBOUND_WEBHOOK_SECRET` | unset | Enables `/api/inbound` for the relay Worker |
| `TURNSTILE_SECRET_KEY` | unset | Bot protection on login and reset forms (`NEXT_PUBLIC_TURNSTILE_SITE_KEY` at build time) |
| `AI_BASE_URL` | unset | OpenAI-compatible model API base URL for the assistant |
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index a1372a7..b8e9852 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -28,6 +28,26 @@ Update the token so it can read the zone and manage its DNS, Email Routing setti
Cloudflare Email Routing cannot be enabled while another mail provider's MX records are present. Mailflare shows a confirmation before replacing them. Continuing deletes the existing MX records and points incoming mail to Cloudflare Email Routing, so the previous provider will stop receiving mail. The `CF_TOKEN` needs **DNS Edit** permission for this action.
+## Resend or SES domain stays "not verified"
+
+The status is the provider's own, not Mailflare's. After the DNS records are added it can stay pending for several minutes (Resend and SES check public DNS, not Cloudflare's dashboard), and **Check status** re-asks the provider without creating anything. If one record stays stuck, look at the per-record statuses listed under the domain row, then check for a duplicate or older TXT record on the same name, a CNAME that is proxied through Cloudflare (it must be DNS only), or a record created at the wrong name (`send.example.com.example.com`). `dig TXT resend._domainkey.example.com +short` shows what the public sees.
+
+## "This domain has MX records for another mail service"
+
+Only one service can own a domain's MX records. Setting up a receiving provider shows the records it would replace and waits for your confirmation; confirming means the previous service stops receiving mail for that domain.
+
+## Resend says the key can only send mail
+
+A sending-only Resend key cannot add domains or webhooks. Replace it with a full-access key under the domain's Resend card, or add the domain in the Resend dashboard yourself (and, for receiving, create an `email.received` webhook pointing at `/api/inbound/resend`).
+
+## SES receiving setup fails
+
+- **Region.** SES receives mail only in some regions. Use one such as us-east-1, us-west-2 or eu-west-1.
+- **Public address.** SNS must reach `/api/inbound/ses`, so `APP_URL` has to be a public HTTPS address; localhost does not work.
+- **Permissions.** The AWS card lists the permissions the key lacks, with the IAM policy that grants them. Use **Re-check** after attaching it.
+- **Sandbox.** An account in the SES sandbox can send only to verified addresses. Request production access in the SES console.
+- **Subscription pending.** The SNS subscription confirms itself when SNS calls the endpoint; the checklist shows it as not ready until then. Use **Check again** after a minute.
+
## D1 error 7404: Database could not be found
D1 database IDs belong to a specific Cloudflare account. This error commonly means `wrangler.jsonc` contains an ID copied from another account.
@@ -57,3 +77,4 @@ Confirm that:
- `services[].service` in `wrangler.jsonc` is also `mailflare`.
- Email Routing is enabled for the domain in Cloudflare.
- The mailbox has an Email Routing rule pointing to the Worker.
+- If the domain receives through Resend or Amazon SES instead, its receiving checklist is all green, the MX record points at that provider, and `APP_URL` is a public HTTPS address.
diff --git a/package.json b/package.json
index b22ed0d..e97f326 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mailflare",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"scripts": {
"dev": "npm run db:bundle && vite dev --port 3000",