# Features `eml-tmLanguage` (`email.tmBundle`) turns raw email files (`.eml`, `.msg`, `.mbx`, `.mboxz`) into readable, navigable documents in **[Sublime Text 3](https://www.sublimetext.com/3)** and **[TextMate 2](https://macromates.com/)** using the standard `.tmLanguage` grammar (`scopeName: text.eml`). --- ## Syntax Highlighting - **Headers**: Uniformly highlights standard headers (`From`, `To`, `Subject`, `Date`, `Message-ID`), custom `X-*` headers, authentication headers (`DKIM`, `SPF`, `ARC`), `Content-Type` / `Content-Transfer-Encoding`, `key=value` parameters, multi-line folded continuations, and parenthesized RFC 5322 comments. - **Delivery Traces (`Received:`)**: Highlights relay hops (`from`, `by`, `via`, `with`, `id`, `for`, `tls`), hostnames, transmission protocols (`SMTP`, `ESMTP`, `ESMTPS`, `ESMTPSA`, `LMTP`, etc.), queue IDs, relay IPs, TLS parameters inside comments, and trailing timestamps. - **International Text**: Highlights RFC 2047 Quoted-Printable (`?Q?`) and Base64 (`?B?`) encoded-words across UTF-8, European, Cyrillic, East Asian charsets, and RFC 2231 language tags — including inside `Subject:` and folded headers, with single-line boundary guards. - **Addresses, Links & Encodings**: Highlights email addresses (`user@domain`, ``, `mailto:`), HTTP(S) URIs, IPv4/IPv6 and `[IPv6:...]` address literals, RFC 5322 timestamps, Quoted-Printable escapes (`=XX`, soft breaks), and Base64 payload blocks. - **Theme-Friendly**: Uses standard `text.eml` scopes so highlighting adapts naturally across any light or dark color scheme. --- ## Multipart & Embedded Formats - **Nested MIME & Single-Part Messages**: Cleanly delimits multi-level multipart trees (RFC 2046 boundaries, including dotted Outlook/JavaMail delimiters) and isolates epilogues, while accurately routing standalone HTML, XML, Base64 image, Quoted-Printable, and plain-text emails. - **Embedded Languages**: Automatically highlights embedded **HTML** (`text/html`), **XML** (`text/xml`, `application/*+xml`), **calendar invites** (`text/calendar` / `.ics`), **diffs & patches** (`text/x-diff`, `text/x-patch`), and **attached emails** (`message/rfc822`). --- ## Hover Previews *(Sublime Text 3)* - **Inline Images**: Hover over Base64 image blocks to preview `PNG`, `JPEG`, `GIF`, `WebP`, `BMP`, `ICO`, and `SVG` images inline. - **Base64 Text**: Hover over Base64 text blocks to preview the first 50 decoded lines without modifying the file. - **Time Zone Conversion**: Hover over any RFC 5322 timestamp to view both **local time** and **UTC**. - **Fast on Large Files**: Inspects only the scope under your cursor (`extract_scope`) to stay responsive on large emails. --- ## Built-in Commands *(Sublime Text 3)* Available from the **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) and the scoped **Email** right-click submenu (hidden outside `text.eml` views): - **Email: Decode Base64**: Decodes Base64 text blocks in place, with binary safeguards to avoid corrupting the buffer. - **Email: Decode Encoded-Words**: Decodes RFC 2047 encoded header text into readable Unicode in place across a line or selection. - **Email: Decode Quoted-Printable**: Unwraps soft line breaks and decodes `=XX` Quoted-Printable text or HTML bodies in place using the part's declared charset. - **Email: Export Attachment to File**: Exports binary or text-based attachments directly to disk with automatic filename and extension detection. --- ## Navigation, Folding & Editing - **Message Outline (`Goto Symbol` / Symbol Popup)**: Jump straight to `Header Section`, `Message-ID`, `Multipart` containers, `Part` bodies, implicit `text/plain` parts, and named `Attachment` entries (`Cmd+R` / `Ctrl+R` in Sublime Text 3, `Cmd+Shift+T` in TextMate 2). - **Cross-File Lookup *(Sublime Text 3)***: Press `Cmd+Shift+R` / `Ctrl+Shift+R` to find any email across a project by `Message-ID`. - **Comment Toggling**: Press `Cmd+/` / `Ctrl+/` to toggle reply quoting (`> `) or header comments (`( ... )`). - **Code Folding**: Regex folding markers (`foldingStartMarker` / `foldingStopMarker`) for MIME multipart boundaries and multi-line comments. --- ## Sublime Text 3 vs. TextMate 2 | Capability | Sublime Text 3 | TextMate 2 | | --- | :---: | :---: | | Headers, `Received:` traces, links, IPs & timestamps | Yes | Yes | | International RFC 2047 text & nested MIME parts | Yes | Yes | | Embedded HTML, XML, `.ics`, `.diff`/`.patch` & `.eml` | Yes | Yes | | Symbol list outline, comment toggling & regex folding | Yes | Yes | | Hover previews & in-place decode/export commands | Yes | — |