Skip to main content
Glama
OwnMail

OwnMail

Official
by ownlabs-dev
README.md
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/images/ownmail-icon-light.svg">
  <img src="docs/images/ownmail-icon-dark.svg" alt="" width="64" height="64">
</picture>

# OwnMail

Your own mail server in one Go program — with mailboxes AI agents can use.

[![Latest release](https://img.shields.io/github/v/release/ownlabs-dev/ownmail?sort=semver)](https://github.com/ownlabs-dev/ownmail/releases/latest)
[![CI](https://github.com/ownlabs-dev/ownmail/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ownlabs-dev/ownmail/actions/workflows/ci.yml)
[![License: AGPL-3.0](https://img.shields.io/github/license/ownlabs-dev/ownmail)](LICENSE)
[![Container image](https://img.shields.io/badge/image-ghcr.io%2Fownlabs--dev%2Fownmail-blue?logo=docker&logoColor=white)](https://github.com/ownlabs-dev/ownmail/pkgs/container/ownmail)

![A domain's DNS records, each with its check result and copy buttons, and buttons to copy all of them as a zone file or for an AI assistant](docs/images/dns.png)

OwnMail receives, filters, stores and sends mail for your own domains, and
syncs calendars and contacts, on one server you run yourself. It is one
program with a web interface for administrators and one for the people
with a mailbox.

## Why OwnMail

- **One program instead of a stack.** No Postfix, Dovecot, Rspamd and
  glue to keep in sync: SMTP, IMAP, filters, spam checks, signing,
  calendars and contacts run in a single process. The release binary is
  about 33 MB; on a small test setup (3 domains, 7 mailboxes) it used
  around 175 MB of memory.
- **DNS you can get right.** Every domain lists each record it needs,
  checked live (in place, missing or different), with copy buttons, and
  copies all of them at once as a zone file or as step-by-step
  instructions for an AI assistant. OwnMail never changes your DNS itself.
- **Built for AI agents.** Each mailbox has its own MCP endpoint: an agent
  can search, read, sort and send mail within the person's rights. A
  second MCP endpoint manages the whole server with access tokens.
- **Safe to run.** Two-factor sign-in for administrators and mailboxes,
  administrators for single domains, encrypted incremental backups to a
  Storage Box, SFTP, S3-compatible storage or a folder, with restoring of
  single mailboxes, and updates on a click that go back to the old version
  if the new one does not start (with the update container of the compose
  file, or a deploy hook).
- **Groupware included.** Calendars and contacts (CalDAV/CardDAV) that
  sync to phones and computers, filters, out-of-office replies, shared
  mailboxes, rooms and equipment, and forwarding and distribution groups.
- **Easy for mail programs.** Thunderbird and Outlook find their settings
  from the address, Apple devices get a setup file, and each domain can
  have its own server name for mail programs (`mail.your-domain.com`).
- **You see what happens.** The start page shows what stands between
  your server and good delivery and how much mail came in, went out and
  was turned away.

## What it does not do (yet)

- **No webmail**, and no calendar or contacts in the browser: use any
  IMAP and CalDAV/CardDAV program, such as Thunderbird, Apple Mail and
  Calendar, Outlook (over IMAP), or DAVx⁵ on Android. Planned:
  [webmail #13](https://github.com/ownlabs-dev/ownmail/issues/13),
  [calendar #31](https://github.com/ownlabs-dev/ownmail/issues/31),
  [contacts #32](https://github.com/ownlabs-dev/ownmail/issues/32).
- **No Exchange/ActiveSync** ([#34](https://github.com/ownlabs-dev/ownmail/issues/34)).
- No virus scanning, no reports from receivers about your mail, no
  MTA-STS or DANE for outgoing mail ([docs/Usage.md](docs/Usage.md#what-you-get)).

## Quick start

You need:

- a server where **port 25 is open in both directions**: many cloud
  hosters block outgoing port 25 and unblock it only on request;
- the **reverse DNS (PTR)** of the server's address set to the mail
  server's name, at your hoster;
- a **domain you control**, to point the mail server's name and the mail
  records at the server;
- **Docker** with the Compose plugin (or [systemd](docs/systemd.md)).

[docs/Docker.md](docs/Docker.md#before-you-start) explains each of these
and how to test them. Then:

1. Point `mail.example.com` at the server (`A` record) and fetch the
   compose file:

   ```sh
   mkdir ownmail && cd ownmail
   curl -fsSLO https://raw.githubusercontent.com/ownlabs-dev/ownmail/main/docker-compose.yml
   printf 'OWNMAIL_HOSTNAME=mail.example.com\nOWNMAIL_ACME_EMAIL=you@example.com\n' > .env
   ```

2. Start it and read the one-time setup code from the log:

   ```sh
   docker compose up -d
   docker compose logs ownmail | grep setup_code
   ```

3. Open `https://mail.example.com/admin`, create the first administrator
   with the code, add your domain and enter the DNS records it shows.

Other ways to run it: [systemd](docs/systemd.md),
[Coolify](docs/Coolify.md), or the image `ghcr.io/ownlabs-dev/ownmail`
[behind your own reverse proxy](docs/Docker.md#behind-your-own-reverse-proxy).
All flags and paths: [docs/Reference.md](docs/Reference.md).

## Screenshots

| | |
|---|---|
| ![The administration's start page: what needs attention, domains, mailboxes, backups and the mail traffic of the last 24 hours](docs/images/overview.png) | ![A mailbox in the administration: storage, sending limits, devices and app passwords](docs/images/mailbox.png) |
| **The start page:** what needs attention and the mail traffic | **A mailbox** in the administration |
| ![The mailbox owner's own page: settings for mail programs, calendars and contacts](docs/images/account.png) | ![The administration's start page in the dark theme](docs/images/overview-dark.png) |
| **The mailbox owner's own page** | **Dark theme** |

## AI programs (MCP)

OwnMail speaks the Model Context Protocol in two places:

- **`https://<mail server>/mcp`**, per mailbox: an AI program (Claude
  Code, Cursor, claude.ai, ChatGPT, …) can list folders, search and read
  messages and attachments, flag, move and delete them, save drafts, set
  the out-of-office reply, and send, reply and forward, with the same
  rights and sending limits as the person. Connect it with an app password
  or by signing in and choosing what it may do (read, organise, send).
- **`https://<mail server>/api/mcp`**, for administrators: manage domains,
  DNS records, mailboxes, forwarding, settings and backups with an access
  token that can be limited to reading. It never reads mail.

```sh
claude mcp add --transport http mail https://mail.example.com/mcp \
  --header "Authorization: Bearer <app password>"
```

Details: [docs/MCP.md](docs/MCP.md) for the administration,
[docs/Usage.md](docs/Usage.md#ai-programs) for mailboxes.

## Documentation

- [Usage](docs/Usage.md): domains and DNS records, mailboxes, forwarding,
  sharing, filters, mail programs, AI programs, administrators.
- [Docker](docs/Docker.md), [systemd](docs/systemd.md),
  [Coolify](docs/Coolify.md): running OwnMail.
- [Reference](docs/Reference.md): commands, flags and paths.
- [Backups](docs/Backups.md), [Updates](docs/Updates.md),
  [Releases](docs/Releases.md).
- [MCP](docs/MCP.md): the administration for AI programs and scripts.
- [Groupware](docs/Groupware.md) and [Architecture](docs/Architecture.md):
  how it is built and why.

The full index is [docs/README.md](docs/README.md).

## Status

OwnMail is a young project (current release
[v0.4.0](https://github.com/ownlabs-dev/ownmail/releases/latest)) and
changes quickly. Release versions are computed from Conventional Commits,
see [docs/Releases.md](docs/Releases.md). Read the release notes
before you update, and keep backups.

## Contributing

Issues and pull requests are welcome; for bigger changes please open an
issue first. How to build, test and run it locally:
[CONTRIBUTING.md](CONTRIBUTING.md). The rules of the codebase are in
[AGENTS.md](AGENTS.md).

## Security

Please report vulnerabilities privately as described in
[SECURITY.md](SECURITY.md), never in a public issue.

## License

[AGPL-3.0](LICENSE).