我已经在 R 中使用 RDCOMClient 包一年多了,没有出现任何问题。
现在突然给我一个错误:
<checkErrorInfo> 80070057
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147024809
Error: The parameter is incorrect.
Run Code Online (Sandbox Code Playgroud)
这是我的代码(出于隐私原因我已经清理了代码):
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)
Run Code Online (Sandbox Code Playgroud)
我计划发送电子邮件的其他脚本很少。其中之一使用blastula包(也通过Outlook发送电子邮件),我在那里没有问题。
知道为什么我会收到此错误吗?