Sending Email
Sending Email
| SendMail[<|"To"->address,"Subject"->subj,"Body"->text|>] | send a basic email message |
| SendMail[<|…,"Body"->{expr1,expr2,…}|>] | send arbitrary Wolfram Language expressions |
| SendMail[<|…,"Attachments"->file|>] | send a message with file attachments |
The examples below require that the default mail account settings have been configured in the Internet & Mail ▶ Mail Settings tab of the Preferences dialog.
SendMail[
<|"To" -> "info@wolfram.com",
"Subject" -> "Example Message",
"Body" -> "My text"|>
]Table[Export["sinPlot" <> ToString@n <> ".jpg", Plot[Sin[x], {x, 0, 2n π}]], {n, 3}]SendMail[
<|"To" -> "info@wolfram.com",
"Subject" -> "Example Attachments",
"Body" -> "Files are attached.",
"Attachments" -> {"sinPlot1.jpg", "sinPlot2.jpg", "sinPlot3.jpg"}|>
]You can also send arbitrary Wolfram Language expressions within the body of the email. SendMail automatically converts the expressions to an appropriate file format and attaches them (inline, where possible) to the email.
This converts Wolfram Language expressions in the body of the email and attaches them appropriately for email:
SendMail[
<|"To" -> "info@wolfram.com",
"Subject" -> "Sending Mathematica Expressions as Attachments",
"Body" -> {"Attach arbitrary Mathematica expressions to the body of your email.
E.g., images:
", [image],
"Mathematica graphics:
", [image],
"Sounds:
", Sound[Play[Sin[4Pi t] ^ 2Sin[440 2Pi t], {t, 0, 1}]],
"Notebooks:
", CreateDocument[{x + y, 1 / x + 1 / y}]}|>
]