Send mail from R using outlook

2,167 views
Skip to first unread message

gooloo

unread,
Jun 9, 2015, 10:53:50 AM6/9/15
to israel-r-...@googlegroups.com
I tried to run the below script and got an error message.

Scrip:
library(RDCOMClient)
## init com api
OutApp <- COMCreate("Outlook.Application")
## create an email 
outMail = OutApp$CreateItem(0)
## configure  email parameter 
outMail[["To"]] = "de...@dest.com"
outMail[["subject"]] = "some subject"
outMail[["body"]] = "some body"
## send it                     
outMail$Send()

Error message:
<checkErrorInfo> 80020009 
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147352567
Error: Exception occurred.


Thanks



Tal Galili

unread,
Jun 9, 2015, 2:04:24 PM6/9/15
to israel-r-...@googlegroups.com
Might this work instead:
?



----------------Contact Details:-------------------------------------------------------
Contact me: Tal.G...@gmail.com
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)
----------------------------------------------------------------------------------------------


--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ariel Pinco

unread,
Jun 10, 2015, 1:15:43 AM6/10/15
to israel-r-...@googlegroups.com
Thanks, but i need to send via outlook.
--
Thanks
Ariel Pinco


Yoni Sidi

unread,
Jun 15, 2015, 4:02:24 AM6/15/15
to israel-r-...@googlegroups.com

sendEmail =  function(To=som...@somewhere.com, Subject="Email Subject", msgBody="",file="") {

      require(RDCOMClient)

      OutApp=COMCreate("Outlook.Application")

      OutMail=OutApp$CreateItem(0)

      OutMail[["To"]]=To

      OutMail[["Subject"]]=Subject

      OutMail[["Body"]]=msgBody

      if(file!="") OutMail[["Attachments"]]$Add(file)

     OutMail$Send()

    }

happy emailing
yoni
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ariel Pinco

unread,
Jun 15, 2015, 4:55:19 AM6/15/15
to israel-r-...@googlegroups.com
Thanks.


To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks
Ariel Pinco


--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages