searches the specified mail folder for messages with properties matching elements in assoc.


searches the current default mail inbox.


gives the list of unread messages in the current default mail inbox.

Details and Options

  • MailSearch[] does not include messages that have been marked for deletion.
  • Mail folders are specified as follows:
  • MailFolder[]a single mail folder
    {MailFolder[],}list of mail folders
    MailServerConnection[]all mail folders for a particular mail server connection
  • The current default mail inbox is as specified in $IncomingMailSettings.
  • Basic search keys to use in assoc include:
  • "From"message sender
    "To"message addressee(s)
    "Cc"recipients copied on the message
    "Bcc"recipients blind-copied on the message
  • Date-related search keys include:
  • "SentBefore"messages sent before the specified date
    "SentOn"messages sent on the specified date
    "SentAfter"messages sent after the specified date
  • Size-related search keys include:
  • "SizeLessThan"messages smaller than the specified byte size
    "SizeGreaterThan"messages larger than the specified byte size
  • Metadata-related keys include:
  • "Flags"protocol-defined flags (e.g. "Answered", "Flagged", "Draft", )
    "Tags"user-defined tags
  • Other keys include:
  • "Body"full text search for the message body
    "Text"full text search for any field
  • Keys such as "To" can have values in which separate items are either given in a list or as parts of a string separated by commas.
  • MailSearch has the following options:
  • MaxItemsAutomaticmaximum number of mail items to return
    TimeConstraintAutomatictime constraint for retrieving mail items
  • With the setting TimeConstraint->Automatic, MailSearch running with a notebook front end will typically terminate with a message if the time constraint is exceeded. It will keep going if there is no notebook front end.


open all close all

Basic Examples  (1)

Connect to the configured mail server:

Click for copyable input

Open the "Example" folder:

Click for copyable input

Search for messages received since yesterday:

Click for copyable input

Options  (2)

Neat Examples  (1)

Introduced in 2018