tags:

views:

180

answers:

4

I have a scheduled R script running from a windows machine. After it finishes, I wish this script to automatically send an email with some log file attached. Using shell() with some other scripts may be possbile, but I was wondering if there is a better solution within R. thanks.

+2  A: 

Have you looked into the sendmailR package yet? It allows SMTP to submit a message and you could probably edit the function to allow an attachment. Then again, if its only one log file it might just be worth it to use shell() as you mentioned.

Stedy
A: 

I'm not aware of R functions or libraries to send email. Most people would either write a shell script or use system() to call an external mail sender.

Some sample code that uses the latter approach is in this mailing list post, but it uses the Unix/Linux mail command. It may be possible to script something similar for Windows, or you could install the Cygwin package on your machine.

neilfws
+4  A: 

Would you settle for a twitter message? You could use Rcurl to post an update to twitter, which can then be forwarded to your cell phone as a text, or to your email via the notification settings.

See here: http://www.sakana.fr/blog/2007/03/18/scripting-twitter-with-curl/

chrisamiller
There is a CRAN package called twitteR for interfacing twitter from R: http://cran.r-project.org/web/packages/twitteR/index.html
Dirk Eddelbuettel
+1 for using Twitter, very clever
Stedy
A: 

You could use a Perl script and call it from R.

stevejb