Last active
April 9, 2016 02:18
-
-
Save sahilseth/b37072ff64c29ca5241cfff0578321c5 to your computer and use it in GitHub Desktop.
sending mail from R with attachments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sendmailR) | |
send_mail <- function(msg="", subject, tos = c("[email protected]"), attachment} | |
from <- sprintf("<abc@%s.inst.edu>", Sys.info()[4]) | |
if(missing(subject)) | |
subject <- paste("morning!") | |
salute <- paste("Hello there\n I just ran the tracker on ") | |
body <- c(salute, "\n", msg, "\n", mime_part(attachment)) | |
sapply(tos,function(to) sendmail(from, to, subject, body, control=list(smtpServer="mail.institute.org"))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment