SMTP IMAP POP3

REST Mail

Because the mail server protocol is old, and needs to take a REST…

A modern REST-native email server that speaks SMTP to the world and HTTPS to its peers. When two REST Mail servers find each other, they automatically upgrade — no configuration needed.

I

What is REST Mail?

The Problem

Running your own email server has always been painful. You need to configure Postfix for SMTP, Dovecot for IMAP, worry about SPF, DKIM, DMARC, manage queues, deal with bounces, set up TLS certificates, fight spam — all with protocols designed in the 1980s.

These protocols served us well, but they were built for a different era. It is time for them to rest.

The Solution

REST Mail replaces the internal complexity with a clean REST API. Every mailbox operation — send, receive, search, label, filter — is an HTTP endpoint. Your webmail, mobile app, or automation scripts talk REST.

But REST Mail still speaks SMTP, IMAP, and POP3 to the outside world through protocol gateways. The rest of the internet never knows the difference. Full compatibility, modern internals.

II

How It Works

Protocol gateways translate legacy protocols into REST API calls, preserving full compatibility while modernizing the internals.

The Outside World
Legacy Servers
Gmail, Outlook, Postfix, etc.
Email Clients
Thunderbird, Apple Mail
SMTP
IMAP / POP3
Protocol Gateways
SMTP Gateway
Postfix + Go bridge
IMAP / POP3 Gateway
TLS :993 / :995
REST
REST
REST Mail Core
REST API + Pipeline
Go, chi, PostgreSQL

Three Test Domains Show the Interop

mail1.test
Traditional
Postfix + Dovecot
mail2.test
Traditional
Postfix + Dovecot
mail3.test
REST Mail
REST-native delivery

mail1 and mail2 communicate over standard SMTP. When either talks to mail3 (a REST Mail domain), the connection automatically upgrades to HTTPS/REST — faster, richer, end-to-end encrypted.

III

The REST Mail Protocol

When two REST Mail servers discover each other, they skip SMTP entirely and deliver natively over HTTPS.

1

DNS Discovery

The sending server looks up a DNS TXT record at _restmail.recipient-domain.com. If the record exists, the recipient is running REST Mail.

$ dig TXT _restmail.example.com
;; ANSWER:
_restmail.example.com. TXT "v=restmail1 endpoint=https://mail.example.com/v1"
2

EHLO Capability Exchange

During the SMTP EHLO handshake, both servers advertise their REST Mail capability. If both sides support it, the upgrade is negotiated.

S: 250-mail.example.com Hello
S: 250-STARTTLS
S: 250-SIZE 52428800
S: 250 X-RESTMAIL v1 https://mail.example.com/v1
3

REST Delivery

Instead of continuing the SMTP transaction, the sending server delivers the message directly via an authenticated HTTPS POST to the recipient's REST API endpoint.

POST /v1/deliver HTTP/2
Host: mail.example.com
Content-Type: application/json
Authorization: Bearer <signed-jwt>

{
  "from": "alice@sender.com",
  "to": ["bob@example.com"],
  "subject": "Hello from REST Mail",
  "body_html": "<p>Delivered over REST!</p>",
  "delivered_via": "restmail/https"
}
IV

Features

Everything you need to run email as a first-class service.

Protocol Compatibility

Full SMTP, IMAP, and POP3 gateways. Use Thunderbird, Apple Mail, Outlook, or any standard email client. The outside world never knows.

REST API First

Every mailbox operation is an HTTP endpoint. Send, receive, search, label, and manage mail with standard REST calls.

Pipeline Engine

16+ built-in filters: SPF, DKIM, DMARC, greylisting, rate limiting, Sieve scripts, webhooks, JavaScript, and more. Chain them in any order.

Sieve Support

Industry-standard Sieve scripting for server-side mail filtering. Users write their own rules without touching server config.

React Webmail

A modern webmail client built with React and Vite, served directly from the stack. Real-time updates via Server-Sent Events.

Console Admin

A terminal-based admin interface built with Bubble Tea. Manage domains, users, mailboxes, and pipelines from the command line.

Real-time SSE

Server-Sent Events push new messages and status updates to connected clients instantly. No polling required.

Attachment Dedup

Content-addressable attachment storage. Identical files are stored once regardless of how many messages reference them.

Quota Management

Per-user and per-domain storage quotas with real-time tracking. Prevent runaway usage before it becomes a problem.

V

Architecture

A complete email stack built on proven technology.

Go Backend

The REST API, protocol gateways, outbound queue, console admin, and all tooling are written in Go 1.24+. Single static binaries, fast compilation, excellent concurrency.

PostgreSQL

All data lives in PostgreSQL via GORM with AutoMigrate. Messages, attachments, domains, users, pipelines, queue state — everything in one reliable store.

chi Router

Lightweight, idiomatic Go HTTP routing. Middleware chains for JWT auth, logging, CORS, rate limiting, and request validation.

React Webmail

Vite-built React frontend with real-time SSE updates. Compose, read, search, and manage mail from the browser.

Bubble Tea TUI

Terminal admin interface for managing the entire stack. Domains, users, mailboxes, pipelines — all from your terminal.

Docker Compose

One command brings up the entire stack: Postfix, Dovecot, PostgreSQL, dnsmasq, API, gateways, webmail. Production-ready from the start.

VI

About

REST Mail is an open-source project exploring what email infrastructure looks like when you start from REST and work backward to legacy protocol compatibility, rather than the other way around.

It is a love letter to the engineers who built SMTP, IMAP, and POP3 — and a gentle suggestion that after 40+ years of faithful service, these protocols have earned their rest.

The entire stack is designed to be self-hosted, developer-friendly, and transparent. No vendor lock-in. No cloud dependency. Just a modern email server you can understand, modify, and trust.

License
MIT
Language
Go 1.24+