MailSearch

MailSearch[folder,assoc]

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

MailSearch[assoc]

searches the current default mail inbox.

MailSearch[]

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.

Examples

open allclose all

Basic Examples  (1)

Connect to the configured mail server:

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

Open the "Example" folder:

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

Search for messages received since yesterday:

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

Options  (2)

Neat Examples  (1)

See Also

MailServerConnect  MailFolder  MailExecute  MailItem  TextSearch

Introduced in 2018
(11.3)