MBOX (.mbox, .mbx)

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 supports all common variants of the mbox file 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.

ElementsElements

  • 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 DateList specification
    "Data"message body
    "Attachments"list of attachments, imported as a Mathematica 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.

OptionsOptions

  • 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:

In[1]:=
Click for copyable input
Out[1]=

Extract message subjects from an MBOX file:

In[1]:=
Click for copyable input
Out[1]=

Import the message dates:

In[2]:=
Click for copyable input
Out[2]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »