ZSZainSpireDownload PDFLibrary
Email · self-hosted · step by step · updated 17 Nov 2026

Free custom domain email with Mailflare

Stop paying every month for business email. Mailflare is an open-source Google Workspace alternative: email on your own domain, plus calendar, booking links, drive and an AI agent. It runs on your own Cloudflare account.

Save this guide as a PDF to read it later, even offline.Download PDF
In one lineDomain on Cloudflare → deploy Mailflare → open /setup → connect domain → turn on free sending with Resend → create [email protected].
GitHubgithub.com/hieunc229/mailflare6.7k stars · AGPL-3.0 · checked 17 Nov 2026
CostReceiving: free (Cloudflare Email Routing). Sending: free with Resend's free tier (3,000 emails a month). You only pay for your domain.

01What you need

Already have email on this domain?Only one service can own a domain's MX records. When Mailflare takes over receiving, your old email provider stops receiving mail for that domain. Move old mail first (Mailflare can import from IMAP, Gmail Takeout, .eml and .mbox), or test on a new domain.

02Put your domain on Cloudflare

  1. Create a free account at cloudflare.com and choose Add a domain.
  2. Cloudflare gives you two nameservers. Set them at your domain registrar (where you bought the domain).
  3. Wait until Cloudflare shows the domain as Active.

03Create the CF_TOKEN

Mailflare needs a scoped Cloudflare API token to set up email routing and DNS for you.

  1. In Cloudflare: Manage Account → Account API Tokens → Create token.
  2. Policy: Specified Domains (pick the domains you will connect), with these permissions:
    • DNS & Zones → DNS → Edit
    • DNS & Zones → Zone → Read
    • DNS & Zones → Zone Settings → Edit
    • Email & Messaging → Email Routing Rules → Edit
  3. Copy the token secret (not the token ID, and without the word "Bearer"). Keep it private.

04Deploy Mailflare

  1. Open the GitHub page and click Deploy to Cloudflare.
  2. Choose the Cloudflare account that owns your domain.
  3. Set the app name to exactly mailflare. Do not rename it, or it breaks.
  4. When it asks for variables/secrets, paste your token into CF_TOKEN.
  5. Start the deploy and wait until it finishes.

05Finish setup

  1. Open your new app's URL and go to /setup.
  2. Let it check the Cloudflare setup and prepare the database.
  3. Create your admin account.

06Connect your domain (free receiving)

  1. Enter your domain (it must be on the same Cloudflare account as the token).
  2. Choose Cloudflare to receive mail. Mailflare turns on Email Routing and adds the DNS records.
  3. Pick the address for your first mailbox, for example [email protected].

07Turn on free sending with Resend

Cloudflare's own sending needs the paid Workers plan ($5/month). For free sending, use Resend:

  1. Create a free account at resend.com and make an API key with full access (resend.com/api-keys).
  2. In Mailflare: Admin → Domains, expand your domain, open Setup sending email, switch on Resend and paste the key.
  3. Click Setup. Mailflare adds the domain to Resend and writes the DKIM/SPF records. Verification can stay "pending" for a few minutes.
  4. Send a test email to your Gmail and check it arrives.

08Mailboxes, team and the extra apps

09Prefer your own server? Docker

Mailflare also runs as one Docker container on any server, with SQLite and local files:

git clone https://github.com/hieunc229/mailflare.git
cd mailflare
cp .env.docker.example .env.docker
docker compose up -d --build

Details are in docs/self-hosting.md in the repo.

10Sell it as a service

Every small business wants [email protected] instead of a Gmail address. As a freelancer you can:

  1. Offer a setup package: domain on Cloudflare, Mailflare deploy, 3–5 mailboxes, Resend sending, test emails, and a 15-minute training call.
  2. Add a monthly care plan: new mailboxes, password resets, updates and backups.
  3. Upsell: booking link on their website, shared calendar for staff, importing old Gmail mail.
  4. Make a demo first: set it up on your own domain and record a 1-minute screen video.

11Good to know