represents an item of mail associated with an active mail server connection.


  • Lists of MailItem[] objects are typically obtained using MailSearch[], or from properties of MailFolder[] objects.
  • MailItem[] displays in StandardForm with subject and body snippet, as in a typical mail client program.
  • MailItem[]["prop"] gives the specified property of a mail item.
  • Possible properties that can be found without retrieving the full contents of a mail item include:
  • "Flags"flags set for this message
    "Tags"user-defined tags set for this message
    "Folder"folder containing this message
    "OriginatingDate"date and time from message headers
    "OriginatingTimezone"time zone from message headers
    "From"sender name and email address
    "FromAddress"sender raw email address
    "Subject"the subject of the email
    "Snippet"snippet from the beginning of the message body
    "ToList"recipient names and addresses
    "ToAddressList"recipient addresses
    "ToNameList"recipient full names
    "CcList"copied recipient names and addresses
    "CcAddressList"copied recipient addresses
    "CcNameList"copied recipient full names
    "BccList"blind-copied recipients (for Sent folder only)
    "MessageID"unique ID for this message
    "MessagePosition"position of the message within the mail folder
    "MessageSummary"association giving basic elements of the message
  • Other possible properties of MailItem include all elements available through EML import.
  • Basic elements from within the message include:
  • "Body"message body as a string
    "Attachments"list of processed attachments as expressions
    "AttachmentData"list of associations giving raw data on attachments
  • Message body elements:
  • "NewBodyContent"parts of the body that are not replies or forwards
    "QuotedContent"parts of the body that are quoted
  • Attachment-related elements:
  • "AttachmentSummaries"list of associations giving basic attachment elements
    "Attachments"list of expressions giving the content of attachments
    "AttachmentNames"list of names assigned to attachments
    "AttachmentAssociations"associations giving content and metadata of attachments
  • Elements related to message routing include:
  • "Precedence"declared mail precedence
    "ReturnReceiptRequested"whether a return receipt is requested
    "DeliveryChainHostnames"hostnames on the mail delivery chain
    "DeliveryChainRecords"full records on the mail delivery chain
  • Elements associated with mail headers include:
  • "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
  • Elements associated with message origination include:
  • "OriginatingMailClient"stated type of originating mail client
    "OriginatingIPAddress"IP address of the originating client machine
    "OriginatingHostname"hostname of the originating client machine
    "OriginatingCountry"geoIP-inferred originating country


Basic Examples  (1)

Click for copyable input

Get the mail folder named "INBOX" from the mail server:

Click for copyable input

Get the last message:

Click for copyable input

See Also

MailExecute  MailFolder  MailSearch  MailServerConnection

Introduced in 2018