Export and save email

How to Save Emails to Google Drive

Updated 3 min read

On this page
  1. Save one Gmail message as a PDF
  2. Save an attachment or an email file
  3. Use mailmd to archive messages in Drive

To save one Gmail message in a form that is easy to read, print it to PDF and upload the file to Google Drive. For a larger, searchable archive, mailmd is the recommended option: it copies messages into individual Markdown files on your computer, which you can then upload to Drive. Markdown is a plain-text format that keeps text and basic structure readable.

These methods preserve different things. A PDF is convenient for reading; an email-message file or archive is better when you need the original message data or many messages. mailmd does not connect to Drive directly, so its local archive must be uploaded separately.

Save one Gmail message as a PDF #

On a computer, open the message in Gmail and choose More → Print. To include every message in a conversation, choose Print all instead. In Chrome’s print dialog, select Save as PDF and save the file. Gmail documents the separate print options for a message and a conversation in its printing instructions.

Next, open Drive and select New → File upload, then choose the PDF. You can also use Drive’s file and folder upload controls to add saved files. Google’s Chrome extension can add Drive as a print destination. Chrome also supports saving a PDF already open in its viewer to Drive; that saves the PDF, rather than exporting a Gmail message directly.

A PDF is a readable printout, not a complete mailbox archive. Check that it contains the message or conversation you intended to save, and save important attachments separately.

Save an attachment or an email file #

To save an attachment without saving the email text, open the message, hover over the attachment, and select Add to Drive. Google says Add to Drive is unavailable for some attachments. For a photo shown inside the message, download it first, then upload it to Drive. See Gmail’s attachment instructions.

To keep a message as an email file, open it in Gmail, select More → Download message, then upload the downloaded EML file to Drive. EML is a format for an individual email; Google says a desktop mail client is needed to open the downloaded file. Gmail’s download instructions describe this option.

Use mailmd to archive messages in Drive #

To archive many messages, mailmd saves each one as a Markdown file on your computer. The file header at the top contains message details. mailmd also saves attachments beside the messages and sorts the files into folders. It converts HTML email into readable Markdown with links and tables. Use --keep-raw to save the original EML file too.

To connect your Gmail account through IMAP, a standard that lets mail programs access messages in your mailbox, run:

curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
mailmd connect imap --email you@example.com
mailmd sync

Many providers require an app password, a separate password for a mail program, to use IMAP. mailmd indicates when you need one. To connect through Gmail’s API, which lets software work with Gmail, use mailmd connect gmail --client-secret client_secret.json. You need to set up your own OAuth app in Google Cloud so mailmd can request access to your account. mailmd also supports Outlook.com through Microsoft Graph. That connection requires an OAuth app in Microsoft Entra.

After syncing, the archive is in ~/mail/<account>. Upload that folder to Drive. mailmd is a free, open-source tool that you run by entering commands. It only reads mailbox contents: it does not mark messages as read, move or delete them, or send email. It adds new messages on later syncs and keeps archived files even if the corresponding server messages are deleted. Spam and trash are excluded by default. See mailmd’s setup instructions.

The archive stays on your computer until you upload it. mailmd stores its login details outside the archive. Only your computer user account can read them, but they are not encrypted. The messages themselves can contain sensitive information, so check the Drive folder’s sharing access before uploading. A Drive copy also uses Drive storage; copying messages there does not by itself free Gmail storage.

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 export and save email