{"id":50283551,"url":"https://github.com/goliajp/mailrs","last_synced_at":"2026-06-10T13:00:48.618Z","repository":{"id":359069356,"uuid":"1170405844","full_name":"goliajp/mailrs","owner":"goliajp","description":"AI-native mail server — SMTP/IMAP in Rust + React web UI","archived":false,"fork":false,"pushed_at":"2026-06-06T07:05:37.000Z","size":8948,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2026-06-06T09:23:08.566Z","etag":null,"topics":["email","imap","mail-server","postgresql","react","rust","smtp"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goliajp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-02T04:48:00.000Z","updated_at":"2026-06-06T07:05:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/goliajp/mailrs","commit_stats":null,"previous_names":["goliajp/mailrs"],"tags_count":542,"template":false,"template_full_name":null,"purl":"pkg:github/goliajp/mailrs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goliajp%2Fmailrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goliajp%2Fmailrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goliajp%2Fmailrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goliajp%2Fmailrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goliajp","download_url":"https://codeload.github.com/goliajp/mailrs/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goliajp%2Fmailrs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34153483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","imap","mail-server","postgresql","react","rust","smtp"],"created_at":"2026-05-28T01:08:55.260Z","updated_at":"2026-06-10T13:00:48.611Z","avatar_url":"https://github.com/goliajp.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mailrs\n\nAn AI-native mail server written in Rust with a React web UI. Handles SMTP\ninbound/outbound, IMAP, JMAP, CalDAV/CardDAV, ManageSieve, POP3, and provides\na modern conversational email interface.\n\n## Architecture\n\nmailrs is organized as a Cargo workspace with **44 crates** — 1 server\nbinary + **43 reusable library crates** (42 of them published on\n[crates.io](https://crates.io/users/golia-jp)).\n\nThese library crates cover the full email-protocol + auth stack and are\nindividually reusable in any Rust project; the server binary wires them\ninto a deployable mail server. See [ARCHITECTURE.md](./ARCHITECTURE.md)\nfor the crate-by-crate breakdown and [DEPS_AUDIT.md](./DEPS_AUDIT.md) for\nthe rewrite-vs-keep ledger on every external dependency.\n\n```\nserver (mailrs-server binary)\n│\n├── Protocol parsers (zero-I/O)\n│   ├── smtp-proto / imap-proto         — wire-format command parsers + state machines\n│   ├── rfc5322 / rfc2047 / rfc2231     — RFC 5322 headers, encoded-words, MIME params\n│   ├── mime                            — RFC 2045/2046 MIME body tree\n│   ├── ical                            — RFC 5545 iCalendar + iTIP\n│   ├── jmap / dav                      — JMAP (RFC 8620), CalDAV/CardDAV (RFC 4791/6352)\n│\n├── Email auth (mail-auth full replacement)\n│   ├── spf  / dkim  / dmarc            — RFC 7208 / 6376 / 7489\n│   └── srs                             — Sender Rewriting Scheme for forwarding\n│\n├── Infra primitives\n│   ├── rate-limit / auth-guard         — token bucket / per-IP lockout\n│   ├── dnsbl / clamav                  — anti-spam + AV\n│   ├── backoff / webhook-signature     — retry math + HMAC payload signing\n│   ├── tls-reload / acme               — hot-reload rustls + Let's Encrypt\n│   └── dns                             — minimal hickory wrapper\n│\n└── Server building blocks\n    ├── smtp-client / outbound-queue    — outbound delivery\n    ├── maildir / mailbox               — storage + metadata\n    ├── inbound / shield                — multi-stage acceptance + anti-spam\n    ├── postmaster                      — bounce/DSN + DNS health checks\n    ├── intelligence / clean            — LLM classification + HTML sanitize\n```\n\nProtocol crates have **zero I/O** — the server crate owns all async\nnetworking via Tokio. Every library crate has its own perf budget\n(`tests/perf_gate.rs`), criterion benches, fuzz target where applicable,\nand a CHANGELOG.\n\n### Performance posture (full ledger in [PERFORMANCE.md](./PERFORMANCE.md))\n\n| Scenario | mailrs | competitor | gap |\n|---|---:|---:|---|\n| RFC 5322 message scan + Subject + From extract | 46 ns | Go `net/mail`: 1440 ns | **mailrs 31×** |\n| iCalendar parse | 1.76 µs | C `libical` 4.0: 7.03 µs | **mailrs 4×** |\n| SMTP `EHLO` command parse | 18 ns | Rust `smtp-codec`: 126 ns | **mailrs 7×** |\n| DKIM-Signature realistic parse | 405 ns | Rust `mail-auth` 0.9: 423 ns | **mailrs +4%** |\n| Rate-limit hot-key check | 13-16 ns | Rust `governor` 0.10: 14-18 ns | **mailrs / tied** |\n\nCross-language harness (with C / Go runners): `bench-harness/`.\n\n### Quality posture\n\n- **Tests**: ~1500 across the workspace; every published crate ≥ 30 tests/kloc.\n- **Fuzz**: 13 libFuzzer targets across 8 parsers (`smtp-proto`, `imap-proto`, `rfc5322`, `rfc2047`, `mime`, `dkim`, `spf`, `ical`). **~120M iterations run cumulatively, 1 real bug caught + fixed** (`rfc2047::encode` roundtrip on inputs containing `=?`).\n- **Property tests**: 9 proptest cases on rfc2047, rfc2231, srs encoder/decoder roundtrips.\n- **Cross-competitor benches**: 8 head-to-head benches against `mail-auth` (×2), `mail-parser` (×3), `icalendar`, `governor`, `exponential-backoff`, `smtp-codec`, `imap-codec`.\n- **Build hygiene**: `#[deny(warnings)]` + `#[deny(clippy::all)]` workspace-wide; `#![deny(missing_docs)]` on every published crate.\n- **Cargo audit**: clean (637 deps, 0 vulns at last check).\n\n### Inbound Pipeline\n\nIncoming mail passes through a multi-stage acceptance pipeline: rate limiting, PTR check, DNSBL, greylisting, SPF/DKIM/DMARC verification, content scanning, Sieve filtering, and final delivery.\n\n### Web Frontend\n\nReact 19 + TypeScript + Vite + Tailwind CSS 4 + Jotai for state management. Real-time updates via WebSocket. Conversation-style thread view with Markdown rendering.\n\n## Tech Stack\n\n| Layer       | Technology                                    |\n|-------------|-----------------------------------------------|\n| Server      | Rust, Tokio, Axum                             |\n| Database    | PostgreSQL 18 (pgvector)                      |\n| Cache       | Kevy / Redis                                |\n| Storage     | Maildir                                       |\n| Frontend    | React 19, Vite 7, Tailwind CSS 4, Bun         |\n| Auth        | PostgreSQL accounts + Argon2, TOTP 2FA, LDAP  |\n| TLS         | Let's Encrypt (ACME) with hot-reloadable certs|\n\n## Features\n\n- **SMTP** — Full inbound and outbound with STARTTLS, DKIM signing, SPF/DMARC verification\n- **IMAP** — IMAP server with IDLE support for real-time notifications\n- **POP3** — POP3 server for legacy client support\n- **JMAP** — JMAP protocol support (RFC 8620)\n- **CalDAV/CardDAV** — Calendar and contact sync for Thunderbird, Apple Calendar/Contacts\n- **ManageSieve** — Remote Sieve script management (RFC 5804)\n- **Web UI** — Conversational email interface with real-time WebSocket updates\n- **MCP** — Model Context Protocol server with 52 tools for AI agent integration\n- **Security** — Greylisting, DNSBL, rate limiting, MTA-STS, TOTP 2FA\n- **Delivery** — Outbound queue with retry logic and DSN (bounce) generation\n- **Sieve** — Server-side mail filtering\n- **ACME** — Automatic TLS certificate provisioning via Let's Encrypt\n- **AI** — Email classification, AI-assisted drafting and reply suggestions (Gemini)\n\n## Quick Start\n\n### Docker Compose (recommended)\n\n```bash\ngit clone https://github.com/goliajp/mailrs.git\ncd mailrs\n\n# configure environment\nexport MAILRS_HOSTNAME=mx.example.com\nexport MAILRS_LOCAL_DOMAINS=example.com\n\n# start all services\ndocker compose up -d\n```\n\nThis starts PostgreSQL (with pgvector), Kevy, and the mailrs server. Ports exposed:\n\n| Port | Service         |\n|------|-----------------|\n| 25   | SMTP            |\n| 110  | POP3            |\n| 143  | IMAP            |\n| 465  | SMTPS           |\n| 587  | SMTP Submission |\n| 993  | IMAPS           |\n| 995  | POP3S           |\n| 3100 | Web UI / API    |\n| 4190 | ManageSieve     |\n\n### Local Development\n\nPrerequisites: PostgreSQL and Kevy running locally.\n\n```bash\n# start dependencies\ndocker compose up postgres kevy -d\n\n# run the full dev stack (SMTP + IMAP + Web API + Vite dev server)\n./scripts/dev.sh\n```\n\nOr run components separately:\n\n```bash\n# rust server\ncargo run --bin mailrs-server\n\n# web frontend (requires Bun)\ncd web \u0026\u0026 bun install \u0026\u0026 bun run dev\n```\n\n## Configuration\n\nAll configuration is via `MAILRS_*` environment variables. Key settings:\n\n| Variable                | Description                        |\n|-------------------------|------------------------------------|\n| `MAILRS_HOSTNAME`       | Server hostname (MX record)        |\n| `MAILRS_LOCAL_DOMAINS`  | Comma-separated local domains      |\n| `MAILRS_PG_URL`         | PostgreSQL connection URL           |\n| `MAILRS_KEVY_URL`     | Kevy/Redis connection URL         |\n| `MAILRS_MAILDIR`        | Maildir storage path               |\n| `MAILRS_USERS_FILE`     | Path to `users.toml`               |\n| `MAILRS_DKIM_*`         | DKIM signing configuration         |\n| `MAILRS_ACME_*`         | Let's Encrypt ACME settings        |\n| `MAILRS_TLS_CERT/KEY`   | TLS certificate and key paths      |\n\nPostgreSQL and Kevy are optional — the server starts in degraded mode if either is unavailable.\n\n## License\n\nSee [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoliajp%2Fmailrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoliajp%2Fmailrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoliajp%2Fmailrs/lists"}