我已经在 R 中使用 RDCOMClient 包一年多了,现在没有问题。
现在突然它给了我一个错误:
<checkErrorInfo> 80070057
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147024809
Error: The parameter is incorrect.
这是我的代码(由于隐私,我已经清理了代码):
library(RDCOMClient)
library(lubridate)
rmarkdown::render("/report.Rmd", encoding = "UTF-8")
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
text <- paste("Attached is the report")
path_to_attachment <- "W:\\Rwd\\report\\report_this_month\\report.pdf"
outMail[["to"]] = "user@xyz.is"
outMail[["subject"]] = "Monthly report"
outMail[["htmlbody"]] = text
outMail[["attachments"]]$Add(path_to_attachment)
outMail$Send()
rm(OutApp, outMail)
我计划发送电子邮件的其他脚本很少。其中一个使用 blastula 包(也通过 Outlook 发送电子邮件),我没有问题。
知道为什么我会收到此错误吗?