Peter M.
Peter M.

Reputation: 1

Sending R Mails with Outlook and changing SaveSent messageFolder

I use MS Outlook for sending e-Mails within R. Altough I have two mailboxes I want to place mails, that I send from the secondary mailbox, in the sent-folder of the secondary mailbox. In the following code I use the command

    outMail[["SaveSentMessageFolder"]] <-
outApp[["Session"]]$Folders("[email protected]")$Folders("Gesendete Elemente"

)

afterwards I get the following error:

<checkErrorInfo> 80020009 
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147352567
Error: Ausnahmefehler aufgetreten.




    require(RDCOMClient)
    OutApp <- COMCreate("Outlook.Application")
    outMail <- OutApp$CreateItem(0)
    outMail[["to"]] <- "[email protected]"
    outMail[["subject"]] <- "TEST"
    outMail[["bodyformat"]] <- 2
    outMail[["SentOnBehalfOfName"]] <- "[email protected]"
    outMail[["HTMLbody"]] <- '<FONT FACE="Trebuchet MS"<br>Sehr geehrte Damen und Herren<br><br>Das ist ein Test<br><br>Beim Datenimport sind folgende Fehler aufgetreten:<br><br>'
    outMail[["SaveSentMessageFolder"]] <- outApp[["Session"]]$Folders("[email protected]")$Folders("Gesendete Elemente")
    outMail$Send()

I don't know how to write the command correctly. How is the correct syntax for the command?

Upvotes: 0

Views: 15

Answers (0)

Related Questions