sends mail consisting of body to the address specified by $WolframID.


sends mail with the specified subject and no body.


sends mail with the specified subject and body.


sends mail with the attachment or attachments att.


sends mail to the specified To: address.


sends mail to multiple To: addresses.


includes the cci as Cc: addresses.


also includes the bcci as Bcc: addresses.


sends mail with elements specified in the association assoc.

Details and Options

  • SendMail attempts to send the specified email to all recipients, returning Success or Failure.
  • Email addresses are given as strings.
  • The message body can be a string, an expression, or a list of expressions.
  • SendMail automatically embeds the following types of expressions as separate parts in a message:
  • EmbeddedHTML["string"]an HTML body part
    Hyperlink[]embedded hyperlink in the body
    CloudObject[]a cloud object with an embedded URL
    Image[],Graphics[],a GIF file
    Audio[], Sound[]a WAV file
    Dataset[], TimeSeries[],a CSV file
    NotebookObject[]a .nb file
    XMLObject[]an XML file
    InputForm[expr]a .wl file of Wolfram Language code
    ExportForm[expr,"fmt"]a file in the format specified by "fmt"
    exprraster image file of the formatted form of expr
    {expr1,expr2,}a sequence of email body parts
  • SendMail uses appropriate encodings to handle any special characters that appear in a message.
  • On desktop systems, SendMail requires certain user mail settings. These can be defined through Preferences Internet & Mail Mail Settings in the notebook front end or by using SetOptions[SendMail,MailSettings]. SendMail will attempt to send email via the Wolfram Cloud if these settings have not been provided. »
  • In the Wolfram Cloud, emails are always relayed from the Wolfram Cloud server.
  • In SendMail[assoc], the association assoc can include the following basic elements:
  • "To"{}email addresses of primary recipients
    "Cc"{}email addresses of secondary recipients
    "Bcc"{}email addresses of hidden recipients
    "Subject"Nonemessage subject line
    "Body"Nonemain message body
    "TextBody"Noneadditional message body for text clients
    "HTMLBody"Noneadditional message body for HTML clients
    "AttachedExpressions"{}expressions to send as attachments
    "AttachedFiles"{}files to send as attachments
    "Priority"Automaticemail priority
    "ReturnReceipt"Nonewhere to send a return receipt
  • If "Body" is specified, it is included in the message before "TextBody" and "HTMLBody".
  • With "AttachedExpressions"->"file1"->expr1,, each expression expri is attached with the filename filei.
  • "Priority" can have settings "High", "Normal" or "Low", or 1 (high) through 5 (low).
  • "ReturnReceipt"->Automatic returns a receipt to the sender. "ReturnReceipt"->None returns no receipt. "ReturnReceipt"->"address" returns a receipt to the specified address.
  • The association assoc can contain the following additional elements, which can also be given when setting the option MailSettings:
  • "AutoBcc"Noneautomatic hidden recipients
    "AutoCc"Noneautomatic secondary recipients
    "FromAddress"Automaticsender's email address
    "FromName"Nonesender's full name
    "ReplyTo"Nonesuggested address for replies
    "Signature"Nonetext to be appended at the end of the email
  • The following elements related to the mail connection can also be given in the association assoc, and in the settings for MailSettings:
  • "EncryptionProtocol"Automaticemail encryption protocol
    "Password"Automaticuser password
    "PortNumber"Automaticserver port number or numbers
    "Server"Automaticserver host name or IP address
    "ServerAuthentication"Automaticwhether and how to verify server certificates
    "Username"$Usernameuser login name
  • Possible settings for "EncryptionProtocol" include "SSL/TLS", "StartTLS" and None. With the setting Automatic, the encryption is chosen based on the server used.
  • "Password" is typically set to None if no password authentication is required, or to Automatic if the password is to be entered in an interactive dialog. The password can also be given as a plain text string.
  • Email credentials can be optionally stored via the "Password" interactive dialog. The credentials are encrypted using keys stored on your computer's hard drive. The encrypted credentials will be transmitted to the Wolfram Cloud and may only be accessed after you have authenticated using your Wolfram ID.
  • SendMail has the following options:
  • MailAddressValidationAutomaticfunction for address validation
    MailSettingsAutomatican association of mail settings
  • The setting for MailAddressValidation is applied to all sender and recipient email addresses. If validation fails for any address, SendMail will not send any message.


open all close all

Basic Examples  (2)

Send a text email to the specified recipient:

Click for copyable input

Send an arbitrary expression to the specified recipient:

Click for copyable input

Scope  (32)

Options  (9)

Applications  (1)

Introduced in 2008
Updated in 2018