EML (.eml)
Background & Context
-
- MIME type: message/rfc822
- Electronic mail message format.
- Used by most mail systems to save individual mail messages.
- Textual format, with encoded binary data.
- Supports Multipurpose Internet Mail Extensions (MIME).
- Supports RFC 2045, RFC 2046, RFC 2047, RFC 4288, RFC 4289, and RFC 2049.
Import
- Import["file.eml"] imports an EML file, returning an association giving basic elements of the corresponding mail message.
- Import["file.eml",elem] imports the specified element from an EML file.
- Import["file.eml",{elem,suba,subb,…}] imports a subelement.
- Import["file.eml",{{elem1,elem2,…}}] imports multiple elements.
- The import format can be specified with Import["file","EML"] or Import["file",{"EML",elem,…}].
- See the following reference pages for full general information:
-
Import import from a file CloudImport import from a cloud object ImportString import from a string ImportByteArray import from a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Basic whole-message elements:
-
"MessageSummary" association giving basic elements of the message "MessageElements" association giving main elements of the message "FullMessageElements" association giving all elements of the message - Import by default uses the "MessageElements" element.
- Summary elements:
-
"From" sender name and email address "ToList" recipient names and addresses "CcList" copied recipient names and addresses "BccList" blind-copied recipient names and addresses "OriginatingDate" date and time on client from email headers "Subject" the subject of the email "BodyPreview" short preview of the message body "HasAttachments" whether the message contains any attachments "MessageID" message ID for this message - "MessageSummary" includes all summary elements.
- Additional message elements:
-
"FromAddress" sender raw email address "FromName" sender full name "ToAddressList" recipient addresses "ToNameList" recipient full names "CcAddressList" copied recipient addresses "CcNameList" copied recipient full names "BccAddressList" blind-copied recipient addresses "BccNameList" blind-copied recipient full names "ReplyToList" reply-to names and addresses "ReplyToAddressList" reply-to addresses "ReplyToNameList" reply-to full names "Body" message body as a string "AttachmentList" list of processed attachments as expressions - "MessageElements" includes all summary and message elements excluding "BodyPreview" and "HasAttachments".
- Subelements can also be given in the form {elem,keys} for "FullMessageElements", "MessageElements", and "MessageSummary" where keys can be any element in the association.
- More detailed information for each email can be imported from the following categories.
- Message-body elements:
-
"BodyPreview" short preview of the message body "Body" message body as a string "NewBodyContent" parts of the body that are not replies or forwards "QuotedContent" parts of the body that are quoted - Message identification and threading elements:
-
"MessageID" message ID for this message "ReplyToMessageID" ID of a message to which this replies, if any "ReferenceMessageIDList" ID of "reference" messages, typically on a thread - Message-routing elements:
-
"Precedence" declared mail precedence "ReturnPath" declared return path for the mail "ReturnReceiptRequested" whether a return receipt is requested "DeliveryChainHostnames" hostnames on the mail delivery chain "DeliveryChainRecords" full records on the mail delivery chain - Mail-header elements:
-
"Plaintext" complete raw email as a string "HeaderString" complete email headers as a string "HeaderRules" list of rules for all headers "CharacterEncoding" character encoding for email content "ContentType" MIME content type of email body "MIMEVersion" version of the MIME standard - Message-origination elements:
-
"OriginatingMailClient" stated type of originating mail client "OriginatingIPAddress" IP address of the originating client machine "OriginatingHostname" hostname of the originating client machine "OriginatingCountry" geo IP-inferred originating country "OriginatingDate" date and time on client from email headers "OriginatingTimeZone" client time zone based on email headers "ServerOriginatingDate" date and time on originating server "ServerOriginatingTimeZone" timezone of originating server - Attachment elements:
-
"HasAttachments" whether each message contains any attachments "AttachmentNames" list of attachment names "AttachmentList" lists of processed attachments as expressions "AttachmentSummaries" lists of associations giving basic attachment elements "AttachmentData" lists of associations giving raw encoded data and metadata "AttachmentDecodedData" lists of associations giving raw decoded data and metadata "AttachmentDetails" lists of associations giving attachment content and metadata - The element "AttachmentDetails" is a list giving an association for each attachment. The elements of this association are typically as follows:
-
"Name" name assigned to the attachment "MIMEType" MIME type of the content "Content" imported content "ContentDisposition" content disposition of the attachment "ModificationDate" modification date recorded for the attachment "ByteCount" number of bytes in the decoded content - The element "AttachmentDecodedData" is a list giving an association for each attachment. The elements of this association are typically as follows:
-
"Name" name assigned to the attachment "MIMEType" MIME type of the content "DecodedContent" raw decoded content as a byte array "ContentDisposition" content disposition of the attachment "ModificationDate" modification date recorded for the attachment "ByteCount" number of bytes in the raw decoded content - The element "AttachmentData" is a list giving an association for each attachment. The elements of this association are typically as follows:
-
"Name" name assigned to the attachment "MIMEType" MIME type of the content "RawContent" raw encoded content as a string "ContentTransferEncoding" content transfer encoding of "RawContent" "ContentDisposition" content disposition of the attachment "ModificationDate" modification date recorded for the attachment "ByteCount" number of bytes in the raw encoded content - "AttachmentSummaries" includes "Name", "MIMEType" and the "ByteCount" of the decoded contents for each attachment.
Options
- Import option:
-
"AttachmentRules" < > rules to control how to import attachments - Possible settings for "AttachmentRules" are associations containing:
-
fmtNone import attachments of format fmt as None fmtelem Import element elem when importing fmt attachments fmtfun use a pure function fun on the decoded byte array
The format specification fmt can be any format supported by $ImportFormats or a MIME type.
Examples
open allclose allBasic Examples (4)
Scope (1)
Import specific elements of an email as an Association:
Represent as a Dataset:
Import Elements (52)
Data Representation (8)
"MessageElements" (1)
Import the message as an Association:
"Plaintext" (1)
Content Parsing (2)
Mail Address Header Elements (19)
General Header Elements (4)
Advanced Header Elements (11)
"DeliveryChainRecords" (1)
Import the delivery chain record as an Association: