celestialgod

R send file

Sep 25th, 2016
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.69 KB | None | 0 0
  1. used_pkgs <- c("mailR", "pipeR")
  2.  
  3. if (!all(used_pkgs %in% installed.packages())){
  4.  install.packages(used_pkgs[!used_pkgs %in% installed.packages()])
  5. }
  6. invisible(lapply(used_pkgs, library, character.only = TRUE))
  7.  
  8. list.files("spend_file_folder", full.names = TRUE) %>>% lapply(function(x){
  9.  send.mail(from = "[email protected]",
  10.            to = "[email protected]",
  11.            subject = "MAIL_TITLE",
  12.            body = "no content",
  13.            attach.files = x,
  14.            smtp = list(host.name = "smtp.gmail.com", port = 465,
  15.                        user.name = "GMAIL_ACCCOUNT", passwd = "PASSWORD", ssl = TRUE),
  16.            authenticate = TRUE,
  17.            send = TRUE)
  18. })
Advertisement
Add Comment
Please, Sign In to add comment