R has packages for almost everything, so there is "sendmailR" ....
Uwe Ligges On 28.10.2011 20:04, MacQueen, Don wrote:
The various suggestions seem kind of complex to me, at least on a unix-like system (including Mac OS X). This is what I do: sink('tmp.txt') cat('This is the body of the message\n') sink() system('cat tmp.txt | mail -s "A test email" macque...@llnl.gov') One could probably avoid the temporary external text file using connections, but I haven't had that need. For attachments, the following approach works on at least some systems (RHEL for one): pdf('temp.pdf') ## create a plot dev.off() sink('tmp.txt') ## print() and cat() commands sink() cmd<- '/bin/mailx -s "Subject line text" -a temp.pdf -S replyto=macque...@llnl.gov recipi...@some.host< tmp.txt' system(cmd) It's not hard, of course, to wrap such a thing up in a function with arguments for various elements such as the subject, the file names, the email address(es), and then construct the cmd using paste().
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.