What Is an EML File?
With mailmd How to Delete a Gmail Account Without Losing Your EmailsOn this page
If you have received an email saved with the .eml extension, it is a file containing a single email message. It usually keeps the sender, recipient, subject, date, message text, and any attachments. Email programs use EML files to save and share messages.
An EML file uses the basic structure for internet email: header information comes first, followed by the message content. Attachments and formatted content use MIME, a set of email rules that lets messages carry images, files, and other content. The Internet Message Format describes this structure.
What an EML file contains #
An EML file usually contains email headers with fields like From and To; Subject and Date appear there too, followed by the message body. The body may be plain text or formatted with HTML. Its MIME content stores attachments, as well as images shown within the message. In a basic text editor, these parts may appear as encoded text.
For example, opening an EML file in a text editor can reveal the subject and message text, along with technical headers. An attachment may appear as a long block of encoded characters rather than as a readable document. An email client can read those sections and show the attachment in its original form.
An EML file stores the message. Servers use separate envelope information to route email between them. This information is separate from the message content, as the Internet Message Format draft explains.
How to open an EML file #
Double-click the file to open it with the email program your computer uses for .eml files. Email clients such as Outlook, Thunderbird, and Apple Mail support EML files, though the available options vary by program and version. If no email client opens the file, a text editor can show its contents. It will not display attachments or formatted messages clearly.
According to CodeTwo’s export instructions, Gmail users can download a message as an EML file by opening it, choosing Show original, and selecting Download Original. Export options differ across email services. For example, CodeTwo says that saving from new Outlook for Windows or Outlook on the web may omit the message’s original headers. If you need those headers for troubleshooting or recordkeeping, check that the export method includes them before relying on the saved file.
Handle EML files with the same care as email #
An EML file can contain links and attachments, so treat an unexpected file as you would an unexpected email. Do not open its links or attachments unless you trust the sender and have checked the contents. A text editor lets you inspect visible headers and message text, but it cannot confirm that the message is genuine or that an attachment is safe.
For records or investigations, keep the original EML file when possible. Saving a message as a PDF changes its format and may leave out information from the EML file, such as headers or links between the message and its attachments. Also verify that the export preserved the original headers: some Outlook export methods do not.
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.