Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

MBOX (.mbox, .mbx)

  • Import supports all common variants of the mbox file format.


    Unix mailbox format.
    Holds a collection of electronic mail messages.
    Native archive format of email clients such as Unix mail, Eudora, Mozilla, Netscape, and Thunderbird.
    ASCII format.
    Stores mailbox messages in their original format, with individual messages concatenated and separated by an empty line.
    May contain binary attachment files using an ASCII representation.
    Email applications normally use improved versions of the original Unix mbox format.

Import and ExportImport and Export

  • Import["file.mbox"] imports an mbox file, returning the entire contents as rules.
  • Import["file.mbox"] returns an expression of the form , giving the individual mail messages in the form .
  • Import["file.mbox",elem] imports the specified element from an mbox file.
  • Import["file.mbox",{elem,suba,subb,}] imports a subelement.
  • Import["file.mbox",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","MBOX"] or Import["file",{"MBOX",elem,}].
  • See Import for full general information.
  • ImportString supports the mbox format.


  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Messages"list of mail messages, each given as rules representing the full header information, the message body, and possible attachments
    "From"sender address
    "ReplyTo"suggested address to which replies should be sent
    "To"addresses of primary recipients
    "Cc"addresses of other recipients
    "Subject"message subject
    "Date"message date, given as a DateObject
    "Data"message body
    "Attachments"list of attachments, imported as a Wolfram Language expression if possible
    "RawAttachments"attachments given as a list of raw strings
    "RawData"list of messages as they appear in the mbox file
    "EmailClient"email application used by the sender
    "MIMEVersion"version of MIME protocol used if message is MIME formatted
  • Import by default uses the element.


  • General option:
  • CharacterEncoding"ISOLatin1"raw character encoding used in the file

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

This imports a sample MBOX file:

Click for copyable input

Extract message subjects from an MBOX file:

Click for copyable input

Import the message dates:

Click for copyable input
Introduced in 2007
| Updated in 2014