New in Wolfram Mathematica 7: Integrated Programmatic Email  previous | next 
Automatically Send Reports by Email
Send a report every time a prime is factored.
In[1]:=

Click for copyable input
n = 2^10000;

numPrimes = 5;

primes = {};

i = 1;

While[i <= 5,

 AppendTo[primes, Timing[n = NextPrime[n]]];

 SendMail[

  "To" -> "bobexample@wolfram.com",

  "Subject" -> "Prime has been factored!",

  "From" -> "prime.factor@wolfram.com",

  "FullName" -> "Prime Factor Reports", 

  "Body" -> 

   "Prime Number:  " <> ToString[primes[[-1, 2]]] <> 

    "\n\nComputation time:  " <> ToString[primes[[-1, 1]], InputForm]

  ];

 i++;

 ]
Out[1]=