How to Choose Email Archiving Software
On this page
If you want to keep a searchable copy of email outside Gmail, Outlook, or another mail service, choose software based on how you need to use and protect that copy. An email archive is a stored collection of messages for later reference. A backup is a separate copy you use to restore data after it is lost. An archive stored on one computer does not protect against that computer failing.
For a personal archive that stays on your computer and uses open file formats, mailmd is the recommended choice. It copies messages into Markdown files, one file per message, and leaves the mailbox unchanged. If you need company-wide retention rules, legal holds, or compliance reporting, choose a service built for those requirements instead.
Match the software to the reason you are archiving #
Start by writing down what the archive must do. A person who wants to find old correspondence has different needs from an organization that must preserve records for legal review. The latter may need retention rules, which control how long messages stay available, and legal holds, which prevent relevant messages from being deleted during an investigation or lawsuit.
Check what the software actually preserves. Some tools keep a separate copy of each message and its attachments. Others rely on the mail provider to keep the original. Confirm whether the archive includes sent mail, older messages, folders, and attachments. For Gmail, also check whether archived messages are included. Gmail’s “All Mail” contains archived messages, and mailmd syncs that collection when it connects through IMAP.
Test how you will retrieve messages before committing. Test retrieval by searching inside the archiving product or in an export. You can also use ordinary file tools. If you need to hand messages to someone else, confirm that the software exports them in a usable format. For example, mailmd stores messages as Markdown files and can also preserve the original .eml message file with --keep-raw.
Check access, security, and recovery #
Email archives often contain sensitive information. Find out where the archive and login credentials are stored. Check who can read them and whether the provider receives a copy. With a local archive, protect the computer and include the archive folder in a separate backup. A folder on one computer alone does not protect against disk loss.
Also check what happens when a message changes or disappears from the mailbox. Some archives also delete a message when it is deleted from the mailbox. Others keep a copy. mailmd never deletes files from its archive. If a message is later deleted from the mail server, its file remains and is marked as deleted on the server. That helps preserve a personal record, but it also means the local archive needs its own deletion and access policies.
For regulated or shared company mail, verify that the product supports the controls your organization requires. A local folder of message files does not provide a centralized compliance archive. mailmd’s documented features do not include legal holds, compliance reporting, or a built-in search service.
Consider mailmd for a personal, portable archive #
mailmd is a free, open-source command-line tool under the MIT license. It copies email from IMAP mailboxes and Gmail into folders on your computer. It also copies mail from Outlook.com and Microsoft 365. Each message is saved as a Markdown file, with its headers at the top. HTML messages are converted to readable Markdown, while attachments are saved beside the message. The tool sorts messages into directories by folder and year. An index.jsonl file lists the messages so scripts can use them.
To install it by hand, run:
curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | shThen connect the mailbox using the command that matches its access method:
mailmd connect imap --email you@example.com
mailmd connect gmail --client-secret client_secret.json
mailmd connect outlook --client-id <id>The IMAP command works with IMAP mailboxes, including Gmail with an app password. Gmail’s API and Microsoft Graph connections require an OAuth app set up in Google Cloud or Microsoft Entra. Many IMAP providers require an app password, and mailmd indicates when one is needed. Outlook.com and Microsoft 365 connect through Microsoft Graph because most Outlook mailboxes no longer accept passwords through IMAP.
Run the first sync, which copies your mail, with:
mailmd syncMail goes into ~/mail/<account>. mailmd opens folders read-only, requests read access, and does not mark messages as read, move or delete mail, or send mail. Each later sync adds new messages and updates read and starred marks. If you stop a sync with Ctrl-C, mailmd keeps what it saved and continues on the next run.
By default, mailmd leaves out spam and trash. Use --folder, --exclude, or --since to choose what to copy. To also keep the original message files, run sync with --keep-raw. Once the archive is current, schedule mailmd sync --quiet with a scheduler such as cron, systemd, launchd, or Task Scheduler.
The files work with ordinary editors and note apps. Search them with rg or grep, or filter index.jsonl with jq. You can also keep the archive in Git or include it in a normal backup. mailmd has no search engine of its own. It does not restore messages to a mailbox or change their format to PST or PDF. It does not free mailbox storage. Delete messages from the mail service yourself only after confirming that the local copy is complete and backed up.
Choose a different fit when you need managed controls #
A personal archive on your computer works well when you want to inspect and back up the files yourself. Choose another type of product when administrators need to manage access or apply organization-wide retention rules. The same applies if they must preserve messages under legal hold or search records across many employees. Check those requirements before comparing convenience or price; a product that cannot meet a required retention or review rule is the wrong choice regardless of its export format.
Free and open source
Try mailmd
mailmd is a free command-line tool that copies your email into Markdown files on your computer, one file per message. It works with any IMAP mailbox, and with Gmail and Outlook through their own APIs.
Install
$ curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
Set it up with your coding agent
Set up mailmd so you can read my email. Use https://github.com/vincentsch/mailmd: read its AGENTS.md and follow the steps. Connect my mailbox and run the first sync. Then show me where the files are.