{
  "id": 1239891,
  "title": "What's actually inside an .eml file (and how to read one without Outlook)",
  "url": "https://urgent.news/2026/08/16/whats-actually-inside-an-eml-file-and-how-to-read-one-without-outlook",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-16T09:03:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/caseymarlin/whats-actually-inside-an-eml-file-and-how-to-read-one-without-outlook-3jp1"
  },
  "original_language": "en",
  "account": "An .eml file is a plain-text file in MIME format, which can be opened and read using a text editor. When you double-click an .eml attachment, Windows will attempt to launch Outlook, while a work laptop without a mail client will display the raw text. To read an .eml file programmatically, you must understand its structure and the different components it contains.\n\nHeaders are the first part of the .eml file, with each header appearing on a separate line until a blank line is reached. The Content-Type: multipart/...; boundary=... line indicates that the body is divided into parts, each with its own headers and encoding method. The most common encodings are quoted-printable for text and base64 for attachments.\n\nIn JavaScript, you can read an .eml file using the File API without the need for a server or upload. The process involves splitting the headers from the body at the first blank line, parsing the headers into a map, and then checking if the content type is multipart. If it is, the body must be split further on the boundary and recursively parsed into individual parts. Once parsed, you can access the headers and body of each part.\n\nThere are a few challenges to consider when parsing .eml files. Header folding can be an issue, as long lines of text may wrap onto the next line if they start with a space or tab. You must un-fold these lines before parsing to avoid truncating subjects or other important information. Another challenge is decoding encoded words, which represent non-ASCII characters in headers. Without proper decoding, characters like José may appear as line noise.\n\nAttachments are encoded in base64 and can be decoded into a Blob, which can then be used to create a download link. However, implementing a robust parser that handles all potential edge cases, such as .emlx files used by Apple Mail or .msg files used by Outlook, requires additional care.",
  "summary": "Someone forwards you an email as a .eml attachment. You double-click it, and… nothing useful happens. On Windows it tries to launch Outlook; on a work laptop with no mail client you get a wall of raw text. So what is this file, and how do you read it programmatically? An .eml file is just text Despite the scary-looking contents, a .eml file is a plain-text file in MIME format (RFC 5322 + RFC…",
  "key_points": [
    ".eml files are plain-text MIME format files",
    "Headers appear as separate lines until blank line",
    "Content-Type line indicates multipart body structure"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}