How to Convert Email to Plain Text
On this page
Email conversion can mean three different things: sending a message without formatting, viewing a received message without its HTML design, or saving message content as a text file. The right method depends on which result you need.
For a few messages, use your email service’s formatting controls or copy the content into a plain-text document. To convert a mailbox into readable files and keep them on your computer, mailmd is the best fit: it turns messages into Markdown, a plain-text format that uses simple markers for items such as headings and links. The files are easy to read and search, but they are Markdown files rather than body-only .txt files.
What plain-text conversion changes #
Plain text keeps the message’s text and line breaks but removes rich formatting such as fonts and colors. HTML, the format many emails use for styled layouts, can also include links, images, and tables. Some email messages contain both an HTML version and a plain-text alternative. The email standard describes how a message can carry multiple content types.
Plain text can still include accented letters, non-English scripts, and symbols. The character encoding, which maps characters to stored data, controls how those characters are stored, so check them after conversion. Also review links, tables, and information shown in images. A text copy may not preserve their original layout or meaning.
Send a new message as plain text #
When you want to send an email without rich formatting, choose plain text in the compose window.
In Gmail on a computer, select Compose, open More options at the bottom of the message, and choose Plain text mode. Google’s instructions cover Gmail on a computer and do not give the same steps for its mobile apps. Switching an already formatted draft to plain text removes its formatting, so keep a copy first if that formatting matters. See Gmail’s message-format instructions.
In Outlook for Windows, the controls depend on the version. New Outlook provides Options → Switch to plain text in the compose window. Classic Outlook uses Format Text → Plain Text. To set a default for new messages, use Settings → Mail → Compose and reply in new Outlook or File → Options → Mail in classic Outlook. Microsoft lists the steps and version distinctions in its Outlook format instructions.
In Apple Mail on Mac, choose Format → Make Plain Text while composing. Set a default under Mail → Settings → Composing. Apple notes that replies can follow the original message’s format, depending on the setting.
Read or save a received message #
Classic Outlook has a setting that displays standard incoming mail as plain text. Open File → Options → Trust Center → Trust Center Settings → Email Security, then enable Read all standard mail in plain text. The setting changes how Outlook displays messages without creating a text file. Microsoft documents the setting for classic Outlook.
For a single .txt copy, open the email, copy the text you need, and paste it into a plain-text document. Add the sender, date, subject, or other details you want to keep, then save and reopen the file to check the result. Copying the body alone does not preserve email headers or attachments.
When you download a Gmail message, Google provides an .eml email file, which can retain the message structure and attachments. Renaming .eml to .txt does not convert its contents into clean text. See Gmail’s download instructions.
Convert a mailbox with mailmd #
For many messages, mailmd creates a Markdown file on your computer for each email. It turns HTML messages into readable Markdown, saves attachments beside the message files, and sorts messages into directories by folder and year. It also saves an index.jsonl file, a plain-text list of message details that scripts can filter. It leaves messages in the mailbox and files in the archive in place.
Install mailmd, connect the account, then sync:
curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
mailmd connect imap --email you@example.com
mailmd syncUse IMAP, a way for mail software to access compatible mailboxes. Gmail can also connect through its API, an interface that lets software access Gmail, and Outlook.com or Microsoft 365 through Microsoft Graph, Microsoft’s API. These API connections require an OAuth app, a registered setup for requesting account access, in Google Cloud or Microsoft Entra. Many IMAP providers require an app password, a separate password for mail software; mailmd tells you when you need one. The archive is saved in ~/mail/<account>.
mailmd opens folders in read-only mode, meaning it can view messages but not change them, and requests read access. It does not mark messages as read, move or delete them, or send mail. Later runs add new mail and update whether messages are marked as read or starred. It excludes spam and trash unless requested; for Gmail over IMAP, it syncs All Mail, including archived messages. The mailmd project documents its options for choosing folders and dates.
Markdown is useful for keeping a readable, searchable local copy. If you specifically need a body-only .txt file, extract the text from the Markdown file or use the manual method above. mailmd is a mailbox archive tool, not a mail client or a way to import converted messages back into a mailbox.
Check the converted text #
Before relying on a copy, compare it with the original. Check names, dates, numbers, non-English characters, and link destinations. Rewrite tables whose columns became hard to follow, and describe images if they contain essential information. Keep the original message until the text copy is verified.
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.