how do you send email from R

后端 未结 8 927
情书的邮戳
情书的邮戳 2020-11-29 18:11

I want to send emails from R. This is what I have so far:

library(sendmailR)


from <- \"eamil@example.com\"
to <- \"email2@example.com\"
subject <-         


        
8条回答
  •  甜味超标
    2020-11-29 18:39

    Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.

    Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook

    library (RDCOMClient)
    
    OutApp <- COMCreate("Outlook.Application")
    outMail = OutApp$CreateItem(0)
    outMail[["To"]] = "test@test.com"
    outMail[["subject"]] = "Test Subject"
    outMail[["body"]] = "Body of email"               
    outMail$Send()
    

提交回复
热议问题