Mail-Archiver: an ASP.NET mail archive that needs Postgres, a reverse proxy and three changed passwords
Mail-Archiver is a web application for archiving, searching, and exporting emails from multiple accounts. Featuring folder sync, attachment support, mailbox migration and a dashboard.
At a glance
- What is it?
- Mail-Archiver by s1t5 syncs IMAP, Microsoft 365 and personal Microsoft accounts into a PostgreSQL-backed web app with search, export, restore and retention. This article covers the Docker setup, the credentials you must change, the read-only API and MCP endpoint, and what deletion rules actually do.
- Who is it for?
- Run Mail-Archiver if you want a self-hosted, searchable copy of IMAP or Microsoft mailboxes and you are comfortable operating Docker, PostgreSQL backups and your own HTTPS reverse proxy. Pass on it if you need the application itself to terminate TLS or expect a hardened out-of-the-box deployment.
- Can I use it commercially?
- Yes, with conditions. GPL-3.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 17, 2026, and from our analysis. They are not legal advice.
Star history
- s1t5/mail-archiver2,259 ★ · +49
| Repository | 2026-10-15 | 2026-11-17 |
|---|---|---|
| s1t5/mail-archiver | 2.2k | 2.3k |
49 Stars in the last 33 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Two containers, one Postgres 14 database, and a port 5000 that speaks plain HTTP
The application is a C# project, MailArchiver.csproj, built on .NET 10 according to the Dockerfile. The build stage uses the dotnet sdk 10.0 image, the runtime stage uses aspnet 10.0, and the container listens on ASPNETCORE_URLS=http://+:5000. The runtime image also installs libgssapi-krb5-2, which the Dockerfile comment says MailKit needs.
The repository docker-compose.yml defines two services. mailarchive-app builds from the local Dockerfile, publishes 5000:5000, and mounts appsettings.json, a logs directory and ./data-protection-keys at /app/DataProtection-Keys. The postgres service uses postgres:14-alpine, stores data in ./postgres-data, and has a pg_isready health check that polls every 10 seconds.
The quick start in the README skips the build and pulls s1t5/mailarchiver:latest instead. Either way, port 5000 is HTTP. The README warns that the application does not provide encrypted access over HTTPS and must sit behind a reverse proxy, so an exposed port 5000 sends the admin login over cleartext.
The example compose file ships passwords you are expected to replace
The sample configuration contains working-looking credentials. The connection string reads Host=postgres;Database=MailArchiver;Username=mailuser;Password=masterkey, the admin account is Authentication__Username=admin with Authentication__Password=secure123!, and the repository compose file sets POSTGRES_PASSWORD to masterkey.
The README tells you to set a secure password in both POSTGRES_PASSWORD and the connection string, and to define your own Authentication__Username and Authentication__Password for the admin user. The two database values have to match each other, or the app cannot connect.
The security notes add three items: use strong passwords and change the defaults, set up HTTPS through a reverse proxy in production, and back up the PostgreSQL database regularly. Anyone who copies the sample file and starts it unchanged has an archive of private mail behind a known admin password.
The time zone is the other setting to change, TimeZone__DisplayTimeZoneId, which defaults to Etc/UCT and accepts any IANA identifier such as Europe/Berlin or Asia/Tokyo.
Four account types: IMAP, M365 through Graph, personal Microsoft, and import-only
Accounts come in four kinds. IMAP covers traditional accounts with full synchronization. M365 covers Microsoft 365 mail through the Microsoft Graph API and needs an Azure app registration, with a setup guide in the docs.
Microsoft Personal covers Outlook.com, Hotmail, live.com and M365 Family accounts. It signs in through the OAuth2 Device Code Flow and ships with a pre-registered shared Client ID, so no Azure App Registration is required. Whether to trust a shared client ID for your personal mailbox is a judgment call the README leaves to you.
IMPORT accounts are import-only and exist for migrating existing archives. There is also an M365 Tenant Import form that bulk-imports every Microsoft 365 mailbox of a tenant, either all of them or a selection, and skips existing and disabled accounts.
Gmail does not appear as its own type. The only listed way in for Google mail is the generic IMAP type, and the README does not describe app passwords or OAuth for it.
Retention can delete mail from the server, and the deletion lock only covers manual deletes
Retention policies are the part of this tool that changes your live mailbox. The README describes automatic deletion from the mailserver after a configurable period, set per account with examples of 30, 90 or 365 days, plus a separate retention for the local archive.
The consequence is plain: a retention rule on an account can remove mail from the source server once it has been archived. Test the rule on a throwaway account before pointing it at a mailbox you care about, and read the Retention Policies page in the docs first.
A second control is aimed at compliance. Setting DeletionPolicy__DeletionAllowed=false disables manual deletion of archived emails. Local retention deletion remains exempt and still runs, so the lock does not make the archive immutable. Mail can still age out of it through the local retention setting you configured.
A read-only REST API and an MCP endpoint expose the archive without mailbox credentials
Two programmatic interfaces sit on top of the archive. The REST API, version 1, is read-only and uses scoped per-user API keys. The README says this lets scripts read archived mail without ever exposing mailbox credentials, since a script holds an API key and not an IMAP password.
The second is an MCP server, the Model Context Protocol, offered as an optional Streamable HTTP endpoint at /mcp. It exposes the same read-only archive to AI agents as discoverable tools: search_emails, get_email, list_accounts, list_folders and get_attachment. The repository has an Mcp directory next to Controllers and Services.
Both are read paths. Nothing in the tool list can send, move or delete mail. Still, an agent connected through /mcp can read attachments and message bodies from every account the key's user may access, so the account permissions you set for that user decide what the agent can see.
Search, export and restore: mbox and zipped EML in both directions
Day-to-day use is advanced search with filters, an email preview that shows attachments, and a dashboard with statistics and storage monitoring. Exports can cover an account or a selection of emails, delivered as mbox or zipped EML.
Import runs the other way. MBox and EML in a ZIP are accepted, with folder structure support. You can restore individual emails or entire mailboxes, and a mailbox migration copies emails between mailboxes while preserving folder structure.
For large local imports the compose file has a commented volume line, mounting /path/to/your/mbox/files at /data/import. To use it you also add the path under LocalImport.AllowedPaths in appsettings.json. Skipping that second step means the app will not read from the mounted folder.
Multi-user support assigns permissions per account, and an access log records logins, opening messages, searches and exports. The log is a useful audit trail if more than one person can reach the archive.
Monthly-numbered releases, a fresh documentation site and some rough edges in the README
Releases are numbered by year and month: 2610.1 on 2026-10-11, 2609.1 on 2026-09-22 and 2608.1 on 2026-08-31. The last push was 2026-10-25, the repository is not archived, and the license is GPL-3.0. A nextrelease.md file at the root and a docs build driven by mkdocs.yml round out the release machinery.
The README admits the documentation is still fresh and being expanded. Some of the rough edges are visible in the quick start itself: the compose snippet in the README cuts off mid-line at the depends_on section, and one step contains typos in its wording. Treat the repository docker-compose.yml as the complete reference for the postgres service.
The interface supports 14 languages, includes dark mode, and offers OpenID Connect authentication. Starting and restarting use two commands:
docker compose up -ddocker compose restartThe UI is then reached in a browser through your reverse proxy, where "Email Accounts" and "New Account" lead to the first archive.
Editorial conclusion
Run Mail-Archiver if you want a self-hosted, searchable copy of IMAP or Microsoft mailboxes and you are comfortable operating Docker, PostgreSQL backups and your own HTTPS reverse proxy. Pass on it if you need the application itself to terminate TLS or expect a hardened out-of-the-box deployment. Before connecting a live mailbox, replace the example passwords, set the retention rules on a test account and confirm that account's mailserver deletion setting does what you intend.
Frequently asked questions
Does Mail-Archiver provide HTTPS itself?
No. The README states the application does not provide encrypted access via https and must be placed behind a reverse proxy.
Which email accounts can Mail-Archiver archive?
IMAP accounts, Microsoft 365 accounts through the Graph API, personal Microsoft accounts through OAuth2 Device Code Flow, and import-only accounts for migrating existing archives.
What database does Mail-Archiver need?
PostgreSQL. The repository compose file runs postgres:14-alpine, and the README recommends regular backups of that database.
Can Mail-Archiver delete emails from my mail server?
Yes. Retention policies can delete mail from the mailserver after a configurable period per account, such as 30, 90 or 365 days. Manual deletion in the archive can be blocked with DeletionPolicy__DeletionAllowed=false.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/s1t5-mail-archiver)Star history chart for your README
[](https://hysenlabs.com/projects/s1t5-mail-archiver)Was this useful?