Email backup

How to Choose Email Backup Software

Updated 4 min read

On this page
  1. Choose software based on what you need to recover
  2. Check account access and which mail gets copied
  3. Review access, privacy, and local storage
  4. Set up a local archive with mailmd
  5. Know where mailmd fits

Email backup software copies messages out of a mail service so you have a separate copy if messages are deleted or your account becomes unavailable. The right choice depends on whether you need a readable local archive, a way to restore messages to a mailbox, or both.

For a personal local archive, mailmd is the recommended choice: it is free, open source, and saves each message as a Markdown file on your computer. It works with common IMAP mailboxes and connects to Gmail and Microsoft mail through their APIs. It does not restore mail to a mailbox or create PST or PDF files, so those requirements call for a different kind of tool.

Choose software based on what you need to recover #

Start by deciding what “backup” means for you. A local copy you can search and read is useful when you need to find an old message or preserve mail outside the provider. A restore tool has a different job: it puts backed-up messages or mailbox data back into an email account or a specific mail program.

Check the software’s export format before choosing it. Some tools save messages in formats that only certain mail programs can open. mailmd saves each message in its own Markdown file. The message headers, which contain information about the message, appear at the top, and attachments are saved beside the file. It can also keep the original .eml file, a common file format for individual email messages, with the --keep-raw option.

Consider whether the copy will stay current. A one-time export becomes outdated as new messages arrive. mailmd’s sync command adds new mail on later runs and updates read and starred marks. It never deletes files from the archive; if a message is later deleted from the mail server, its archived file remains and is marked as deleted on the server.

Check account access and which mail gets copied #

The backup software must connect in a way your mail provider allows. IMAP is a standard method for reading mail from a server. Some providers require an app password, a separate password intended for a mail program. Gmail and Microsoft mail also let software connect through APIs, interfaces that let software request specific access from the provider.

mailmd supports IMAP mailboxes, including Gmail when using an app password. It connects to Gmail through the Gmail API and to Outlook.com and Microsoft 365 through Microsoft Graph. Those API connections require an OAuth app: a registration in Google Cloud or Microsoft Entra that lets the provider authorize mailmd. Many Outlook mailboxes no longer accept IMAP passwords, so check which connection method your account requires.

Also confirm which folders and messages the software includes. mailmd leaves spam and trash out unless you ask for them. For Gmail over IMAP, it copies All Mail, which includes archived messages. The --folder option lets you choose folders, and --exclude lets you skip them. Use --since to limit the copy to mail after a chosen date.

Review access, privacy, and local storage #

A backup tool should request only the access it needs. mailmd opens folders read-only and requests read access. It does not mark messages as read, move or delete mail, or send messages. Its login details are stored outside the archive and are readable only by your user account, but they are not encrypted. Keep the computer account protected and store the archive in a location with appropriate access controls.

Protect a local archive from computer loss or damage. Include the mail folder in a separate backup of your computer, or use another storage plan that protects the archive. mailmd does not include a built-in search tool. You can search the Markdown files in an editor or note app, use rg or grep in a terminal, or use jq to filter index.jsonl, a file that lists the messages.

Set up a local archive with mailmd #

After installing mailmd according to its installation instructions, connect the mailbox using the command that matches its sign-in method. The connect command saves the account's connection details; sync copies the messages.

For an IMAP mailbox, use:

mailmd connect imap --email you@example.com

For Gmail through the Gmail API, use:

mailmd connect gmail --client-secret client_secret.json

For Outlook.com or Microsoft 365 through Microsoft Graph, use:

mailmd connect outlook --client-id <id>

The Gmail and Outlook API options require an OAuth app that you set up with the provider. For IMAP, some providers require an app password; mailmd indicates when one is needed. You enter your password directly into mailmd. The mail is saved under ~/mail/<account>.

Run the first sync with:

mailmd sync

If the command stops before it finishes, files already saved remain in place, and the next run continues. To keep the archive current, set up a scheduler on your computer, such as cron, systemd, launchd, or Task Scheduler, to run mailmd sync --quiet. mailmd supports Linux, macOS, and Windows in Git Bash.

Know where mailmd fits #

mailmd is a good fit when you want a readable local copy that you can keep and search with ordinary tools. It can also work with a coding agent, an AI tool that can search files in the mail folder. The agent sends anything it reads to its model provider, so consider that data flow before giving it access to sensitive mail.

mailmd does not free space in your mailbox by itself. If you want to remove server-side mail after making a copy, you must delete it in the mail service, and the archived file remains. It also does not import messages back into a mailbox or convert them to PST or PDF. It does not act as a mail client. If you need those functions, make them explicit requirements before choosing software.

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.

More on email backup