Windows COM Client and sending emails through Outlook

windows

#1

I currently have some R code that uses the package RDCOMClient, to send many generated emails through Microsoft Outlook. Is there any way to do this in Julia? I am not a Windows guy, so I don’t know if there might be some way to do this at a lower level? The relevant part of the R code that I am having difficulty translating is

library(RDCOMClient)
outApp <- COMCreate("Outlook.Application")
outMail <- outApp$CreateItem(0)
outMail[["To"]] <- as.character("recipient@mail.com")
outMail[["SentOnBehalfOfName"]] <- "sender@mail.com"
outMail[["subject"]] <- "subject of email"
outMail[["body"]] <- "body of email"
outMail$Save() # to save as draft

#2

It might be easiest to use run() with an external utility. Here are some options:

I haven’t tried it, but one is a PowerShell option (you shouldn’t need to download anything, assuming your target audience will have this installed).


#3

Thanks @tshort!