Emailing multiple attachments using RDCOMClient and Outlook
<p>I have an R script that I want to automatically send an email using Microsoft Outlook after it has finished completing. I'm using the "RDCOMClient" package and I want to add multiple attachments to the email. </p>

<p>Here's the code that I'm trying to use:</p>

<pre><code>library(RDCOMClient)

OutApp &lt;- COMCreate("Outlook.Application")

outMail = OutApp$CreateItem(0)

outMail[["To"]] = paste("recipient@account.com","another@gmail.com", sep=";", collapse=NULL)
outMail[["subject"]] = "some subject"
outMail[["body"]] = "some body"
outMail[["attachments"]]$Add("C:/Path/To/The/Attachment/File.ext")

outMail$Send()
</code></pre>

<p>I tried using paste for the attachments like the "To" option but I'm 99% sure that is what broke the attachments because it works with just one. It works perfectly for adding multiple recipients. Does anyone know how I can add multiple attachments with this package?</p>