Email backup

How to Back Up Outlook Emails

Updated 3 min read

On this page
  1. Save Outlook email as local files with mailmd
  2. Export a PST from Outlook for Windows
  3. Back up Outlook.com and Outlook for Mac
  4. Check the copy and keep it safe

Outlook stores email in a Microsoft account or mailbox. A copy saved only there is not an independent backup. A backup is a separate copy you can keep on your computer or another storage device. To keep readable email files on your computer, mailmd is the recommended tool: it saves messages in Markdown, a plain-text format with simple formatting marks, in folders on your computer. For a traditional Outlook archive that can include other Outlook items, use Outlook’s built-in export to a .pst file. A PST is an Outlook data file that can hold email, attachments, contacts, calendar items, and tasks.

The right method depends on whether you want readable files or an Outlook-compatible archive. Either way, check that the saved copy contains the mail you need before relying on it.

Save Outlook email as local files with mailmd #

mailmd is a free, open-source command-line tool that copies email into one Markdown file per message. It connects to Outlook.com and Microsoft 365 through Microsoft Graph, a Microsoft service that lets tools access account data. To authorize mailmd, create an OAuth app registration in Microsoft Entra. The tool requests permission only to read mail. It does not mark messages as read, move or delete mail, or send messages.

Install it, connect Outlook, and run the first sync:

curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
mailmd connect outlook --client-id <id>
mailmd sync

Replace <id> with the client ID for your Microsoft Entra OAuth app. mailmd prompts you to sign in. The messages are saved under ~/mail/<account>. Attachments are saved beside their messages. Mail folders and years are saved as folders on your computer. HTML messages are saved as readable Markdown, and each message keeps its headers.

The first run creates the copy. Later runs add new mail and update read and starred marks. To keep the backup current, schedule mailmd sync --quiet on your computer. The files can be searched with an editor or tools such as grep. mailmd never deletes archived files, even if a message is later deleted from Outlook.

For Outlook.com or Microsoft 365, use the Graph connection above. Other mailboxes that support IMAP, a standard for accessing email, use a different connection method. Some providers require an app password. mailmd stores login details outside the archive, where they are readable only by your user, but they are not encrypted. Keep the archive and its backups somewhere secure. See the mailmd setup instructions.

Export a PST from Outlook for Windows #

For an Outlook-compatible archive, Outlook’s built-in export saves a PST. In classic Outlook for Windows, open File → Open & Export → Import/Export, choose Export to a file, then Outlook Data File (.pst). Select the account’s main entry and enable Include subfolders to export its folders. Choose a local destination and filename, then finish the export. Microsoft’s PST export instructions cover the full process.

Classic Outlook can export only the mail downloaded to the computer. To include all available messages, change the account’s sync setting to download All, wait for synchronization to finish, and then export.

In new Outlook for Windows, open Settings → Files → Export, select Get started, and follow the export wizard. Review the choices carefully and select a copy-style export if your goal is backup; an option that moves or removes original messages is not a backup copy.

Back up Outlook.com and Outlook for Mac #

For a full Outlook.com mailbox export, Microsoft directs users to desktop Outlook. The Outlook.com export instructions describe the available desktop routes. To save just one message from Outlook on the web, open it and choose More actions → Download.

Microsoft’s documented .olm export for Mac applies to legacy Outlook for Mac. The procedure is Tools → Export (or File → Export, depending on the installation), followed by choosing what to include and where to save the file. Check that legacy Outlook is available and supported for your account before relying on this method; Microsoft describes the legacy Mac export procedure.

Check the copy and keep it safe #

Open a few folders and check both recent and older messages. Open attachments you need. If you exported a PST, Outlook can open it separately so you can inspect its contents before importing anything. Importing copies items into a mailbox and can create duplicates if you choose the wrong options; Microsoft’s PST import instructions explain the choices.

Keep another copy separate from the computer holding the original. A file stored only on that computer is vulnerable to the same loss as the computer itself. A PST export also does not preserve every Outlook setting, such as rules and folder views. The Archive button is different from a backup: it moves a message to a folder in the same mailbox, so it does not create an independent copy.

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