我已经在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发送电子邮件),我在那里没有问题。
你知道为什么我会得到这个错误吗?
发布于 2021-01-05 14:07:35
我遇到了这个错误,并在一段时间内一无所知,但在我的情况下,它最终是我的附件路径错误的问题。
如果我是你,我会首先尝试注释掉outMail[["attachments"]]$Add(path_to_attachment)这一行,看看事情是否像预期的那样工作。
https://stackoverflow.com/questions/65254128
复制相似问题