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].
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
Your own domain, for example noorclothing.pk or yourname.dev (paid yearly to a domain registrar).
A free Cloudflare account, with your domain's DNS on Cloudflare.
A free Resend account (for free sending).
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
Create a free account at cloudflare.com and choose Add a domain.
Cloudflare gives you two nameservers. Set them at your domain registrar (where you bought the domain).
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.
In Cloudflare: Manage Account → Account API Tokens → Create token.
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
Copy the token secret (not the token ID, and without the word "Bearer"). Keep it private.
04Deploy Mailflare
Open the GitHub page and click Deploy to Cloudflare.
Choose the Cloudflare account that owns your domain.
Set the app name to exactly mailflare. Do not rename it, or it breaks.
When it asks for variables/secrets, paste your token into CF_TOKEN.
Start the deploy and wait until it finishes.
05Finish setup
Open your new app's URL and go to /setup.
Let it check the Cloudflare setup and prepare the database.
Create your admin account.
06Connect your domain (free receiving)
Enter your domain (it must be on the same Cloudflare account as the token).
Choose Cloudflare to receive mail. Mailflare turns on Email Routing and adds the DNS records.
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:
Create a free account at resend.com and make an API key with full access (resend.com/api-keys).
In Mailflare: Admin → Domains, expand your domain, open Setup sending email, switch on Resend and paste the key.
Click Setup. Mailflare adds the domain to Resend and writes the DKIM/SPF records. Verification can stay "pending" for a few minutes.
Send a test email to your Gmail and check it arrives.
08Mailboxes, team and the extra apps
Mailboxes: create sales@, support@, hello@, personal or shared, and give team members access.
More domains: Admin → Domains → New domain.
Calendar: repeating events, time zones, email invitations.
Booking: share a public link so clients book a free slot on your calendar.
Drive: store and share files.
AI agent: search mail, draft replies and manage events (needs your AI provider key).
Routing rules: store, forward, reject or sort incoming mail.
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:
Offer a setup package: domain on Cloudflare, Mailflare deploy, 3–5 mailboxes, Resend sending, test emails, and a 15-minute training call.
Add a monthly care plan: new mailboxes, password resets, updates and backups.
Upsell: booking link on their website, shared calendar for staff, importing old Gmail mail.
Make a demo first: set it up on your own domain and record a 1-minute screen video.
11Good to know
New Amazon SES accounts start in a sandbox; you must ask AWS for production access. Resend is simpler for most people.
Keys saved in the app are stored in its database, so protect your database backups.
Attachments through Cloudflare over 5 MiB are sent as download links; inbound mail is capped at 25 MiB.
Free tiers and prices can change. Check Resend, Amazon SES and Cloudflare pricing before you sell a package.
Licence: AGPL-3.0. If you change the code and offer it to others as a service, you must share your changes.