2

I solved this issue but documenting here in case anyone experiences difficulty using RDCOMClient to send Outlook emails via R.

Using fresh install of Windows 10 Pro for Workstations running as a VirtualBox VM, R version 4.1.1, Rstudio 2021.09.0 (Build 351), and Microsoft Office365 Outlook client (version 2102 (Build 13801.20960 Click-to-Run)).

The following code causes R to crash every time on the last line:

install.packages("RDCOMClient", repos = "http://www.omegahat.net/R")
library(RDCOMClient)

# Open Outlook
Outlook <- COMCreate("Outlook.Application")

# Create a new message
Email = Outlook$CreateItem(0)

I rolled back the R version to 3.5.1 -- and it now works.

Conclusion: RDCOMClient is not compatible with latest version of R (4.1.1).

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
cmcgraw
  • 61
  • 4
  • Have you tried getting the Inbox folder or using the Logon method before creating a new item on the problematic version of R? – Eugene Astafiev Oct 24 '21 at 22:46
  • Could you also then post the error messages / problems you experienced so that people are more likely to find this answered question? You can also ask a question and post an answer and then mark the answer as 'community wiki'. – Lexib0y Oct 25 '21 at 06:29
  • @LexibOy -- Good idea -- I would love to post the error, but I can't find any log file associated with it. That last command when run in R causes R simply to exit without warning. In RStudio, this event is caught by RStudio and described as "R encountered a fatal error. The session was terminated" – cmcgraw Oct 25 '21 at 11:14
  • Again, have you tried getting the `Inbox` folder or using the `Logon` method before creating a new item on the problematic version of R? – Eugene Astafiev Oct 25 '21 at 17:38

1 Answers1

0

I rolled back the R version to 3.5.1 -- and it now works.

Conclusion: RDCOMClient is not compatible with latest version of R (4.1.1). I am not sure why and did not trouble-shoot further, since I only need this VM with RStudio to perform one function (send email by Outlook).

Saugat Jonchhen
  • 356
  • 5
  • 16
cmcgraw
  • 61
  • 4