1. Blog
  2. Reviews

Mailflare: Self-Host a Google Workspace Alternative on a VPS

Mailflare: email, calendar and drive on your own VPS

Email on your own domain usually means choosing the lesser of two evils: paying per user for Google Workspace or Microsoft 365, or running a full mail server such as Mailcow and dealing with Postfix, Dovecot, spam filtering and IP reputation. Mailflare offers a third way: a modern web app with email, calendar, meeting booking and file storage that receives mail itself and hands outgoing mail to a proven sending service.

The project appeared in May 2026 and gathered almost 8,000 GitHub stars in six months. You can deploy it to Cloudflare or Vercel, or, which is what this article is about, install it on your own VPS as a single Docker container.

What Mailflare is

Mailflare is an open-source suite of apps for working with email on your own domain. Its author positions it as a self-hosted alternative to Google Workspace. The code is released under the AGPL-3.0 licence and written in TypeScript (Next.js).

The same codebase runs in three ways:

Option Runs on What you need
Cloudflare Workers, D1, R2, Queues a Cloudflare account, a domain on Cloudflare
Vercel Vercel functions an external database and storage
Docker any server, including a VPS Docker, an open port 25

For those who don’t want to run anything, there is a hosted service, Mailflare Cloud. But the project’s main strength is that you can keep all your mail on your own server.

Features

Email

  • mailboxes on your own domains, personal and shared, with access control;
  • multiple domains in one installation;
  • routing rules: store, forward, reject or sort incoming mail into folders;
  • a separate view for newsletters and promotions, plus a rule that moves them to a folder, Spam or Trash;
  • masked addresses in the style of “Hide My Email”, with the option to reply from them;
  • scheduled send and undo send;
  • spam filter strictness levels and domain blocking;
  • DMARC reports, MTA-STS policy hosting and TLS-RPT reports.

Calendar, booking and drive

  • Calendar with recurring events, time zones and email invitations for attendees.
  • Booking: a public link where anyone can book a free slot in your calendar, Calendly-style.
  • Drive for storing and sharing files.

AI assistant and MCP

The built-in assistant searches mail, drafts replies and manages events. It works with any model through an OpenAI-compatible API, including a local one. Mailflare also runs an MCP server for connecting external AI agents to your mail. An agent cannot send mail by itself: it gets a review link, and a person confirms sending in the browser.

Administration and import

  • users, API keys, webhooks, an audit log;
  • daily backups and backup downloads from the admin panel;
  • import of mail from IMAP, Gmail Takeout archives, .eml and .mbox files, plus calendar, contacts and files from Google Takeout;
  • two-factor authentication and passkeys;
  • an interface in 34 languages;
  • installable as an app (PWA) with push notifications for new mail.

How Mailflare receives and sends mail

This is the key thing to understand before installing: Mailflare is not a classic mail server.

Receiving. In the Docker version, the container runs its own SMTP listener on port 25. The domain’s MX record points at your server, and mail arrives directly. The alternative is to keep MX on Cloudflare and relay messages to the server through a small Worker.

Sending. Mailflare has no delivery agent of its own that would send mail directly to other servers. Outgoing mail goes through an external service:

  • any SMTP relay: Amazon SES, Postmark, Mailgun, your hosting provider’s relay or your own Postfix;
  • the Resend or Amazon SES API, per domain;
  • Cloudflare Email Sending.

Resend has a free tier of 3,000 emails a month, and Amazon SES costs pennies per thousand emails. At first glance this looks like a drawback, but in practice it is a real advantage: mail leaves from IP addresses with a good reputation, and you don’t have to set up a PTR record, watch blocklists or warm up a new IP. You don’t need outbound port 25 on the VPS either, since relays work over ports 465 and 587.

Mail clients. Mailflare does not support IMAP or POP3. You can work with mail in the web interface, through the PWA on your phone and in clients that support JMAP, a modern protocol Mailflare implements. Thunderbird, Outlook and the built-in Mail app on iPhone cannot connect over IMAP. Calendar and contact sync over CalDAV/CardDAV is only starting to appear and doesn’t work yet.

Pros and cons

Pros:

  • all in one: email, calendar, booking, drive and an AI assistant;
  • a modern, fast interface in dozens of languages out of the box;
  • a single-container install with no separate database by default: SQLite on a Docker volume;
  • you can plug in PostgreSQL or MySQL and keep files in S3 or Backblaze B2;
  • no deliverability battles: sending goes through a professional service;
  • open source under AGPL-3.0, and the data stays with you;
  • free, apart from the VPS and, at high volumes, the sending service.

Cons:

  • no IMAP, so familiar mail clients can’t connect;
  • sending requires an external service, so fully self-contained email isn’t possible;
  • the project is very young (version 0.5), so expect bugs and breaking changes;
  • the Docker version keeps its job queue in memory: scheduled mail not yet sent when the container restarts won’t go out automatically;
  • inbound port 25 is closed on many cloud platforms, so you need a VPS where it is open.

Mailflare and the alternatives

Mailflare Mailcow Google Workspace
What it is web app: email, calendar, drive full mail server cloud service
Where data lives your server your server Google
Sending mail through an external relay directly from your IP Google’s servers
IMAP, SMTP for clients no, JMAP and web only yes yes
Calendar and drive yes calendar and contacts via SOGo yes
Resources one app, SQLite 6 GB of RAM or more —
Cost VPS plus relay VPS from a few dollars per user per month

If you need a classic mail server that works with any client, choose Mailcow. If you value simplicity, a modern interface and built-in calendar and booking, and you read mail in the browser and on your phone, Mailflare is much easier to install and maintain.

Installing Mailflare on a VPS

What you need

  • A VPS with Docker. There are no official resource requirements. Mailflare is a single Node.js app with SQLite, so for a small team a Linux VPS with 1–2 GB of RAM is a reasonable starting point; size the disk for your mail and files. Docker can be installed with our guide.
  • Inbound port 25 open. Without it the server can’t receive mail. You can test it from another computer once the container is running (command below).
  • A domain whose DNS records you can edit.
  • A sending service: a Resend, Amazon SES or Postmark account, or another SMTP relay.

In all the examples below, example.com is your domain, mail.example.com is the server’s name and 203.0.113.10 is its IP address.

Step 1. DNS records

Add two records:

Type Name Value
A mail.example.com 203.0.113.10
MX example.com mail.example.com (priority 10)

If the domain is on Cloudflare, the mail record must be DNS only (grey cloud), otherwise SMTP traffic won’t reach the server. You’ll add SPF, DKIM and DMARC later: Mailflare and your sending service will show them.

Step 2. Configuration files

Create a directory and download the example settings:

mkdir -p /opt/mailflare && cd /opt/mailflare
curl -fsSL -o .env.docker https://raw.githubusercontent.com/hieunc229/mailflare/main/.env.docker.example

Create a compose.yaml file. It is based on the official docker-compose.image.yml, but the web interface is only available locally; from outside, it will be exposed through a reverse proxy with HTTPS:

services:
  mailflare:
    image: ghcr.io/hieunc229/mailflare:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:3000"
      - "25:25"
    env_file: .env.docker
    volumes:
      - mailflare-data:/data

volumes:
  mailflare-data:

Step 3. Settings in .env.docker

Open .env.docker and uncomment or add these lines:

APP_URL=https://mail.example.com
TRUST_PROXY=1
SMTP_INBOUND_PORT=25
MAIL_HOSTNAME=mail.example.com
SMTP_URL=smtps://USER:PASSWORD@email-smtp.eu-central-1.amazonaws.com:465
  • APP_URL is the public address. Without it, password reset links and passkeys don’t work.
  • TRUST_PROXY=1 is needed behind a reverse proxy; otherwise all requests appear to come from one address and the login rate limit becomes shared by everyone.
  • MAIL_HOSTNAME is the name the MX record points at.
  • SMTP_URL is the relay for sending. The example uses Amazon SES; for Postmark, Mailgun or your own Postfix, use their address. Instead of a relay, you can later enter a Resend or SES key right on the domain page in the interface.

For the AI assistant, add AI_BASE_URL, AI_API_KEY and AI_MODEL with the address and key of any OpenAI-compatible API.

Step 4. Start it

docker compose up -d

Database migrations run automatically on start. Logs:

docker compose logs -f mailflare

From another computer, check that port 25 is reachable from the internet:

nc -vz mail.example.com 25

If the connection fails, check the server’s firewall and ask your hosting provider whether inbound port 25 is blocked.

Step 5. Reverse proxy and HTTPS

You need a proxy that obtains a certificate and forwards requests to 127.0.0.1:3000. It must pass WebSocket traffic, which real-time updates use (/api/realtime).

The shortest option is Caddy: it gets a Let’s Encrypt certificate by itself and supports WebSocket with no extra settings. The /etc/caddy/Caddyfile configuration:

mail.example.com {
    reverse_proxy 127.0.0.1:3000
}

If Nginx Proxy Manager already runs on the server, create a proxy host pointing to 127.0.0.1:3000 (from the NPM container, to the server’s IP address) and turn on WebSocket support in it.

Open ports 25, 80 and 443 in the firewall:

ufw allow 25/tcp && ufw allow 80/tcp && ufw allow 443/tcp

Step 6. Initial setup

  1. Open https://mail.example.com/setup and create the administrator account.
  2. Turn on two-factor authentication or add a passkey right away.
  3. Add your domain. The domain page in Mailflare shows the MX, SPF and DMARC records to create.
  4. Add your sending service’s DKIM and SPF records: Resend, SES or Postmark give them to you when you verify the domain.
  5. Create your first mailbox and send a test email to an external address such as Gmail. mail-tester.com is a handy way to check SPF, DKIM and DMARC.

If you give Mailflare a Cloudflare token with DNS permissions, it will create the records for domains on Cloudflare by itself.

Encrypting inbound connections

Without a certificate, the SMTP listener doesn’t offer STARTTLS, and mail arrives over an unencrypted connection. To enable encryption, mount a certificate for mail.example.com into the container and set its paths inside the container in the SMTP_TLS_KEY and SMTP_TLS_CERT variables. You can reuse Caddy’s certificate or issue a separate one with certbot; remember to restart the container after renewal.

Updates and backups

Before updating, download a backup from the Backups page in the admin panel or copy the mailflare-data volume. Then:

cd /opt/mailflare && docker compose pull && docker compose up -d

Migrations only move forward. To be able to roll back, you can pin a specific build with a tag like sha-abc1234 instead of latest and change it deliberately.

Mailflare makes a backup every day at 02:00 UTC, but keeps it on the same volume as the data. Regularly copy the volume or the backup files off the server, for example to separate storage. You can also keep attachments and drive files in S3-compatible storage from the start, using the S3_* and B2_* variables.

Moving from Gmail and other providers

Mailflare imports mail from any IMAP server, from a Google Takeout archive and from .eml and .mbox files, plus calendar, contacts and Google Drive files from Takeout. The migration order:

  1. Install Mailflare and create the mailboxes, but don’t change the MX record yet.
  2. Import your old mail.
  3. Switch the MX record to the new server.
  4. After a day or two, once DNS has updated everywhere, run the import again to pick up mail that arrived at the old server.

If you are moving between two IMAP servers without Mailflare, imapsync comes in handy.

Frequently asked questions

Is Mailflare free?

Yes. The code is open source under AGPL-3.0; you only pay for the VPS and, at high volumes, for the sending service. Resend has a free tier of 3,000 emails a month, and Amazon SES charges a small fee per thousand emails.

Can I run it without Cloudflare?

Yes. The Docker version receives mail with its own SMTP listener and sends through any SMTP relay. Cloudflare is only needed for the Workers deployment or if you want automatic DNS setup.

Can I connect Thunderbird or Outlook?

Not over IMAP, which Mailflare doesn’t support. You can use the web interface, the PWA on your phone and mail clients that support JMAP. Those get separate app passwords limited to the mailboxes you pick.

Why can’t I send mail directly from the VPS?

Mailflare deliberately leaves out its own delivery agent. Mail from a new IP address with no reputation often lands in spam, so sending through a professional service is usually more reliable. If you want to send yourself, run your own Postfix alongside it and set it in SMTP_URL.

How many resources does Mailflare need?

There are no official requirements. SQLite is used by default and all data lives on one volume, so for a small team a VPS with 1–2 GB of RAM is usually enough. The main cost is disk space for mail, attachments and files.

Is Mailflare production-ready?

It is version 0.5, and the project is six months old. The developer actively fixes vulnerabilities and bugs, but for business-critical email, try it on a separate domain first and be sure to set up backups off the server.

Sources