Email for professionals and teams
minor updates
Hieu Nguyen (Jack)cf9d2a891959
diff --git a/.gitignore b/.gitignoreindex 6f3ecf4..84ee7e5 100644--- a/.gitignore+++ b/.gitignore@@ -50,6 +50,4 @@ next-env.d.ts!.dev.vars.example--wrangler.jsonc-yarn.lock\ No newline at end of file+yarn.lockdiff --git a/LICENSE b/LICENSEnew file mode 100644index 0000000..71b6f08--- /dev/null+++ b/LICENSE@@ -0,0 +1,31 @@+Mailflare Source-Available License++Copyright (c) 2026 Hieu Nguyen. All rights reserved.++This software and associated documentation files (the "Software") are made+available for review, evaluation, and personal or internal deployment only.++Permission is granted to access, read, run, and modify the Software for personal+or internal business use, provided that all copyright, license, and attribution+notices remain intact.++You may not, without prior written permission from the copyright holder:++1. Sell, rent, lease, sublicense, or otherwise commercialize the Software.+2. Offer the Software, a modified version, or a substantially similar derivative+ as a hosted service, SaaS product, template, starter kit, marketplace item, or+ commercial product.+3. Redistribute, publish, mirror, or make available copies of the Software or+ modified versions of the Software.+4. Fork, clone, or copy the Software for the purpose of resale, redistribution,+ public rebranding, or competing commercial use.+5. Remove or obscure copyright, attribution, license, or ownership notices.++The Software is provided "as is", without warranty of any kind, express or+implied, including but not limited to warranties of merchantability, fitness for+a particular purpose, and noninfringement. In no event shall the copyright+holder be liable for any claim, damages, or other liability arising from or in+connection with the Software or its use.++Any use not expressly permitted by this license is reserved by the copyright+holder.diff --git a/README.md b/README.mdindex 824707f..66cdece 100644--- a/README.md+++ b/README.md@@ -23,7 +23,7 @@ Domains are **not** dashboard-only. This app calls Cloudflare when you add/remov| Remove subdomain sending | `DELETE /zones/{zone_id}/email/sending/subdomains/{tag}` || Subdomain sending DNS records | `GET .../subdomains/{tag}/dns` |-**Requirements:** Prefer `CF_TOKEN` with Zone Read + Email Routing Edit + Email Sending Edit + Email Routing Rules Write (or broader). If you use a legacy Global API Key instead, set `CLOUDFLARE_API_KEY` and `CLOUDFLARE_EMAIL`. The hostname must be the account's Cloudflare zone apex or a subdomain under that zone. Root-domain sending uses the Cloudflare Email Service binding, while subdomain sending can also provision the sending-subdomain DNS records. Mailbox creation creates a Cloudflare Email Routing rule that sends that address to `CF_EMAIL_WORKER_NAME` (`lumal` by default).+**Requirements:** Prefer `CF_TOKEN` with Zone Read + Email Routing Edit + Email Sending Edit + Email Routing Rules Write (or broader). If you use a legacy Global API Key instead, set `CLOUDFLARE_API_KEY` and `CLOUDFLARE_EMAIL`. The hostname must be the account's Cloudflare zone apex or a subdomain under that zone. Root-domain sending uses the Cloudflare Email Service binding, while subdomain sending can also provision the sending-subdomain DNS records. Mailbox creation creates a Cloudflare Email Routing rule that sends that address to `CF_EMAIL_WORKER_NAME` (`mailflare` by default).App routes:@@ -57,11 +57,13 @@ Publish this repository to GitHub, then replace `hieunc229/mailflare` in the butThe deploy flow reads `wrangler.jsonc`, provisions the Worker bindings, prompts for values from `.dev.vars.example`, runs D1 migrations, builds the OpenNext Worker, and deploys it.+Keep `wrangler.jsonc` committed. Cloudflare's deploy button uses it to detect the Worker entrypoint and required bindings. Do not commit `.dev.vars`; deploy-time secrets should be entered through Cloudflare's setup flow or set locally in `.dev.vars`.+Required setup values:- `CF_TOKEN` — scoped Cloudflare API token with Zone Read, Email Routing Edit, Email Sending Edit, and Email Routing Rules Write.- `CF_ACCOUNT_ID` — optional unless your token can access multiple accounts.-- `CF_EMAIL_WORKER_NAME` — must match the Worker name in `wrangler.jsonc`; default is `lumal`.+- `CF_EMAIL_WORKER_NAME` — must match the Worker name in `wrangler.jsonc`; default is `mailflare`.After deployment, route inbound mail to the Worker in Cloudflare Email Routing.diff --git a/package.json b/package.jsonindex f531d28..a4bf02b 100644--- a/package.json+++ b/package.json@@ -27,7 +27,7 @@"description": "Optional Cloudflare account ID. Leave blank unless your API token can access multiple accounts."},"CF_EMAIL_WORKER_NAME": {- "description": "Worker name used when creating Cloudflare Email Routing rules. Keep this aligned with the `name` in `wrangler.jsonc`; the template default is `lumal`."+ "description": "Worker name used when creating Cloudflare Email Routing rules. Keep this aligned with the `name` in `wrangler.jsonc`; the template default is `mailflare`."},"CLOUDFLARE_EMAIL": {"description": "Legacy Global API Key auth only. Use this with `CLOUDFLARE_API_KEY` instead of `CF_TOKEN`."@@ -37,6 +37,7 @@}}},+ "license": "SEE LICENSE IN LICENSE","dependencies": {"@opennextjs/cloudflare": "^1.19.9","@radix-ui/react-dialog": "^1.1.15",diff --git a/src/app/utils.ts b/src/app/utils.tsindex 24b98de..6987c50 100644--- a/src/app/utils.ts+++ b/src/app/utils.ts@@ -39,7 +39,7 @@ export const heroMessages: MailPreview[] = [},{icon: MailCheck,- sender: "[email protected]",+ sender: "[email protected]",subject: "Mailbox provisioned",preview: "New routing mailbox is ready for customer replies.",badge: "Admin",diff --git a/src/lib/cloudflare-api-utils.ts b/src/lib/cloudflare-api-utils.tsindex e53b224..d75b6e5 100644--- a/src/lib/cloudflare-api-utils.ts+++ b/src/lib/cloudflare-api-utils.ts@@ -53,5 +53,5 @@ export function getCloudflareAuthHint(errors: CfApiError[]) {}export function getEmailWorkerName(env: CloudflareEnv): string {- return env.CF_EMAIL_WORKER_NAME?.trim() || "lumal";+ return env.CF_EMAIL_WORKER_NAME?.trim() || "mailflare";}diff --git a/worker.ts b/worker.tsindex 6bd3ae4..fdd98cc 100644--- a/worker.ts+++ b/worker.ts@@ -27,7 +27,7 @@ export default {},async queue(batch: MessageBatch, env: CloudflareEnv): Promise<void> {- const isInbound = batch.queue === "lumal-inbound";+ const isInbound = batch.queue === "mailflare-inbound";for (const msg of batch.messages) {try {if (isInbound) {diff --git a/wrangler.jsonc b/wrangler.jsoncnew file mode 100644index 0000000..0e40326--- /dev/null+++ b/wrangler.jsonc@@ -0,0 +1,74 @@+{+ "$schema": "node_modules/wrangler/config-schema.json",+ "name": "mailflare",+ "main": "./worker.ts",+ "compatibility_date": "2026-05-20",+ "compatibility_flags": [+ "nodejs_compat",+ "global_fetch_strictly_public"+ ],+ "assets": {+ "binding": "ASSETS",+ "directory": ".open-next/assets",+ },+ "images": {+ "binding": "IMAGES",+ },+ "services": [+ {+ "binding": "WORKER_SELF_REFERENCE",+ "service": "mailflare",+ },+ ],+ "vars": {+ "CF_EMAIL_WORKER_NAME": "mailflare",+ },+ "observability": {+ "enabled": true,+ },+ "upload_source_maps": true,+ "send_email": [+ {+ "name": "EMAIL",+ "remote": true,+ },+ ],+ "d1_databases": [+ {+ "binding": "DB",+ "database_name": "mailflare",+ "database_id": "f865ab42-f602-45b4-ad72-cac3e21c7834",+ "migrations_dir": "drizzle/migrations",+ },+ ],+ "r2_buckets": [+ {+ "binding": "BUCKET",+ "bucket_name": "mailflare-raw",+ },+ ],+ "queues": {+ "producers": [+ {+ "binding": "INBOUND_QUEUE",+ "queue": "mailflare-inbound",+ },+ {+ "binding": "OUTBOUND_QUEUE",+ "queue": "mailflare-outbound",+ },+ ],+ "consumers": [+ {+ "queue": "mailflare-inbound",+ "max_batch_size": 5,+ "max_retries": 3,+ },+ {+ "queue": "mailflare-outbound",+ "max_batch_size": 5,+ "max_retries": 3,+ },+ ],+ },+}