2016-12-08 1 views

Antwort

0

starten Sie könnten das mailR Paket versuchen. Von der mailR github documentation können Sie eine E-Mail senden und attach.files verwenden, um den entsprechenden Bericht anzuhängen.

library(mailR) 
send.mail(from = "[email protected]", 
      to = c("[email protected]", "[email protected]"), 
      subject = "Subject of the email", 
      body = "Body of the email", 
      smtp = list(host.name = "smtp.gmail.com", port = 465, ssl = TRUE, 
         user.name = "gmail_username", passwd = "password"), 
      authenticate = TRUE, 
      send = TRUE, 
      attach.files = c("./download.log"), 
      file.names = c("Download log.log"), 
      file.descriptions = c("Description for download log")) 

sendmailR kann ein ähnliches Ergebnis erzielen, aber die Bindung an den Körper der E-Mail hinzugefügt mime_part() verwenden.

library(sendmailR) 
from <- '[email protected]' 
to <- '[email protected]' 
subject <- 'Email Subject' 
body <- list('Email body text.', 
      mime_part(x = 'pathToAttachment', y = 'nameOfAttachment')) 
sendmail(from, to, subject, msg = body, 
     control = list(smtpServer='ASPMX.L.GOOGLE.COM')) 
1

Wenn Sie Outlook verwenden, empfehle ich das RDCOMClient-Paket.

install.packages(RDCOMClient) 
require(RDCOMClient) 

OutApp <- COMCreate("Outlook.Application") 
outMail = OutApp$CreateItem(0) 
outMail[["To"]] = "[email protected]" 
outMail[["subject"]] = "subject here" 
outMail[["htmlbody"]] = "email text" 
outMail[["Attachments"]]$Add("c:/file.blah") 
outMail$Send() 
Verwandte Themen