1

I've been using the RDCOMClient packge in R for over a year now without a problem.

Now suddenly it's giving me an error:

<checkErrorInfo> 80070057 
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147024809
Error: The parameter is incorrect.

Here is my code (I've cleaned the code due to privacy):

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)

I have few other scripts that I schedule to send emails. One of them uses the blastula package (also sends email through Outlook) and I have no problem there.

Any idea why I'm getting this error?

1 Answers1

0

I came across this error and was clueless for a while, but in my case it ended up being a matter of my attachment filepath being wrong.

If I were you I would try to first comment out the line outMail[["attachments"]]$Add(path_to_attachment) and see if things work as expected.

Ricky
  • 428
  • 1
  • 5
  • 11
  • The only reason for the email is the attachment so this is not an option for me. This code has been working just fine for more than a year now and the code has been unchanged the whole time so I'm a bit surpriced. – Viðar Ingason Jan 05 '21 at 09:39
  • I'm not saying to remove the attachment completely, I was just thinking you could confirm the error you are running into is due to the attachment not being found like I suspect. If you just commented out that one line and the e-mail works, you would know it's because your attachment filepath is not found. For example in my case I am using the slashes in the other direction `path_to_attachment – Ricky Jan 05 '21 at 15:05
  • Commenting out the attachment did not solve the problem. Still getting the same error. – Viðar Ingason Jan 25 '21 at 09:09