FILEPATH <- "LOCATION OF THE FILE"
EMAIL_ID <- "REQUIRED EMAIL ID"
sendEmail = function(To=EMAIL_ID, Subject="Email Subject", msgBody="",file=FILE_PATH) {
require(RDCOMClient)
OutApp=COMCreate("Outlook.Application")
OutMail=OutApp$CreateItem(0)
OutMail[["To"]]=To
OutMail[["Subject"]]=Subject
OutMail[["Body"]]=msgBody
if(file!="") OutMail[["Attachments"]]$Add(file)
OutMail$Send()
}
已创建功能,但未发送邮件。
执行此操作
OutMail[["To"]]=To OutMail[["Attachments"]]$Add(file)
我面临以下错误
[[<-( tmp ,“ To”,value = list(3L))中的错误:无法附加创建通用COM对象所需的RDCOMServer程序包另外:警告消息:在库中(包,lib.loc = lib.loc,character.only = TRUE,逻辑.return = TRUE ,:没有名为“ RDCOMServer”的包