DataStandardizer.File.InternetMessage
Reading and writing of Internet messages (email) in EML, MHTML, mbox and EMLX files: one message format and the files that hold it. Everything is byte-based, and anything you don’t change is written back byte for byte.
dotnet add package DataStandardizer.File.InternetMessage
Standards
| Standard | What it provides |
|---|---|
| RFC 5322 | Internet Message Format: header fields, addresses, date-times, message identifiers, and the conformance checks of §3.6. The obsolete syntax of §4 is read, and never written. |
| RFC 6532 | Internationalized Email Headers: UTF-8 in field bodies. |
| RFC 6854 | Update to Internet Message Format to Allow Group Syntax in the “From:” and “Sender:” Header Fields. |
| RFC 2045 | MIME Part One: the MIME-Version, Content-Type, Content-Transfer-Encoding, Content-ID and Content-Description fields, and transfer decoding. |
| RFC 2046 | MIME Part Two: multipart bodies, embedded messages and boundaries. |
| RFC 2047 | MIME Part Three: encoded words in display names, keyword phrases, comments and unstructured fields. |
| RFC 2183 | The Content-Disposition Header Field. |
| RFC 2231 | MIME Parameter Value and Encoded Word Extensions, in Content-Type and Content-Disposition parameters. |
| RFC 2387 | The MIME Multipart/Related Content-type. |
| RFC 2392 | Content-ID and Message-ID Uniform Resource Locators: cid: URIs. |
| RFC 2557 | MIME Encapsulation of Aggregate Documents, such as HTML (MHTML). |
| RFC 3282 | Content Language Headers. |
| RFC 4155 | The application/mbox Media Type: mbox files, in the mboxrd, mboxo, mboxcl and mboxcl2 variants. |
EMLX, the format of Apple Mail, has no published standard. The package follows the layout that open-source readers agree on.
The readers and writers follow the standards by default. A reader rejects input that breaks a rule, except where the standard requires a receiver to accept it, and a writer refuses to write a message that breaks one. Each accommodation for common non-compliant input is a separate option that you turn on by name. See Compliant defaults and the opt-ins.
The MIME values and codecs, such as MimeMediaType and MimeCharset, come from DataStandardizer.Communication, which NuGet installs automatically.
The package doesn’t send or receive mail, verify or create signatures, lock a mailbox, or read Outlook .msg files.
Platform support
Targets .NET Standard 1.1, 2.0 and 2.1, and .NET 10.
Applies to: the async API and the file-path constructors need .NET Standard 2.0 or later. On .NET Standard 1.1, read and write synchronously, from a
Stream.ImfOptionsis arecordonnet10.0, sowithexpressions work there, and a plainclasson the .NET Standard targets.
See Platform support for the full matrix.
How-to guides
- Read a message and its attachments
- Stream a large message
- Build and write a message
- Edit one header without breaking a signature
- Open a saved web page
- Read, filter and rewrite an mbox file
- Read Apple Mail EMLX files
- Read text in other character sets
Concepts
- The layers
- Byte-exact round trips
- Compliant defaults and the opt-ins
- Limits for hostile input
- One message format, several file formats
Reference
Table of contents
- Read a message and its attachments
- Stream a large message
- Build and write a message
- Edit one header without breaking a signature
- Open a saved web page
- Read, filter and rewrite an mbox file
- Read Apple Mail EMLX files
- Read text in other character sets
- The layers
- Byte-exact round trips
- Compliant defaults and the opt-ins
- Limits for hostile input
- One message format, several file formats
- API reference
- EmlxEntry Class
- EmlxMessageFlags Enum
- EmlxMetadata Class
- EmlxMissingPart Class
- EmlxPartResolver Delegate
- EmlxPlistValue Class
- EmlxPlistValueKind Enum
- EmlxReader Class
- EmlxWriter Class
- ImfAddress Class
- ImfAddressList Class
- ImfContentDisposition Class
- ImfDateTime Struct
- ImfDiagnostic Class
- ImfDiagnosticKind Enum
- ImfEntity Class
- ImfEntityCollection Class
- ImfEntityEvent Struct
- ImfEntityEventKind Enum
- ImfEntityNode Class
- ImfEntityReader Class
- ImfEntitySource Class
- ImfEntityWriter Class
- ImfFileException Class
- ImfGroup Class
- ImfHeaderEncoding Enum
- ImfHeaderField Class
- ImfHeaderFieldCollection Class
- ImfHeaderFieldKind Enum
- ImfHeaderFieldView Struct
- ImfHeaderReader Class
- ImfHeaderText Class
- ImfHeaderWriter Class
- ImfMailbox Class
- ImfMessage Class
- ImfMessageBuilder Class
- ImfMessageId Class
- ImfMessagePart Class
- ImfMimeFields Class
- ImfMultipart Class
- ImfOptions Class
- ImfPhraseList Class
- ImfReader Class
- ImfResentBlock Class
- ImfTraceField Class
- ImfTraceFieldKind Enum
- ImfWriteProgress Struct
- ImfWriter Class
- MboxEntry Class
- MboxEnvelope Class
- MboxLineBreak Enum
- MboxReader Class
- MboxVariant Enum
- MboxWriter Class
- MhtmlDocument Class
- MhtmlDocumentBuilder Class
- MhtmlReader Class
- MhtmlResource Class
- MhtmlWriter Class