Basic Examples (5)
Basic Examples
(5)
Open a notebook for composing an email:
In[225]:=
Out[225]=
NotebookObject
Press the Send button in the notebook, or use on the to send:
SendMailFromNotebook
In[5]:=
»
Success
Out[5]=
{{{richardh@wolfram.com}},{}}
———
Generate the notebook with some elements filled in:
In[10]:=
Out[10]=
NotebookObject
———
Create and save a notebook that you want to send as an email:
In[87]:=
nb=CreateDocument[{TextCell[$WolframID,"Section"],TextCell["my subject line","Subsection"],TextCell["paragraph 1","Text"],TextCell["paragraph 2","Text"],ExpressionCell[Import["ExampleData/spikey.tiff"],"Output"]}];
path=FileNameJoin[{$TemporaryDirectory,"mail.nb"}];NotebookSave[nb,path];NotebookClose[nb];
Send mail from the notebook:
In[5]:=
»
Success
Out[5]=
{{{richardh@wolfram.com}},{}}
Or send mail with additional elements:
In[6]:=
»
Success
Out[6]=
{{{richardh@wolfram.com}},{}}
———
Process multiple emails from a file:
nb=CreateDocument[{TextCell[$WolframID,"Section"],TextCell["subject 1","Subsection"],TextCell["text 1","Text"],TextCell[$WolframID,"Section"],TextCell["subject 2","Subsection"],TextCell["text 2","Text"]}];NotebookSave[nb,FileNameJoin[{$TemporaryDirectory,"mail.nb"}]];NotebookClose[nb];
In[38]:=
»
Success
»
Success
Out[38]=
{{{testing@example.com},{testing@example.com}},{}}
———
Send the same message to several recipients:
nb=CreateDocument[{TextCell[$WolframID<>", FirstName LastName <testing@example.com>","Section"],TextCell["subject 1","Subsection"],TextCell["text 1","Text"]}];NotebookSave[nb,FileNameJoin[{$TemporaryDirectory,"mail.nb"}]];NotebookClose[nb];
In[59]:=
»
Success
Out[59]=
{{{test1@wolfram.com, FirstName LastName <testing@example.com>}},{}}