I've been using RDCOMClient package as described here Sending email in R via outlook. Everything was working fine with Outlook 2010 and Windows 7. The script is not working since I've changed the system to Windows 10 with Outlook 2016.
Here is the script:
library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "[email protected]"
outMail[["subject"]] = "test"
outMail[["body"]] = "Test."
outMail$Send()
It fails at the last line with the error as follows:
80004004 No support for InterfaceSupportsErrorInfo checkErrorInfo -2147467260 Error: Operation aborted
Suggested workaround is to open message box and simulate pressing Ctrl+Enter:
library(KeyboardSimulator)
library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "[email protected]"
outMail[["subject"]] = "test"
outMail[["body"]] = "Test."
outMail$Display()
Sys.sleep(3)
keybd.press('Ctrl+Enter')
But this method is not 100% reliable.
Do you have any idea how to make outMail$Send() work again?
Thank you!