Closed cataclysmic closed 4 years ago
You haven't provided enough specifics. I'm assuming you are talking about Microsoft Outlook, but you haven't actually said what application you are working with. And there are lots of applications that have email accounts.
Look in the documentation for the DCOM interface for your application.
If you point us to a specific method, we may be able to help with how to use it from RDCOMClient.
But we certainly can't guess the application and the method.
Furthermore, we certainly don't want to help you send a lot of spam so you probably want to convince us this is for a good cause.
Dear Duncan,
I am sorry. I was so deep in thinking about the issue that simply forgot to provide you with enough information. I amended my question above with references to Outlook. It is not my intention to spam the issue tracker.
Using examples from stackoverflow I could send emails using RDCOMClient and Outlook directly and it's working fine. But I would also like to have to possibility to store newly created emails before sending.
I wrote a similar program in Python a while back but want to move it to R so other people in my company can maintain it.
In Python I could simply search for the drafts folder by iterating through the accounts and its subfolders and then add a new item to the respective folder. Like so:
Msg = self.GetOutbox().Items.Add(0)
But I didn't find any document how to do this using RDCOMClient.
So I am looking for a way to do the same using RDCOMClient. 1) find the Drafts folder of some account 2) store a new email object in that folder 3) later send stored emails from the Drafts folder
Thank you in advance.
For what it's worth, this seems to work for me:
outlook_app <- COMCreate("Outlook.Application")
new_mail <- outlook_app$CreateItem(0) # 0 = mail, 1 = cal item, 2 = task
new_mail[["to"]] <- "name@example.org"
# this saves the mail to the default Drafts folder:
new_mail$Save()
# this would display the mail in an Outlook window:
new_mail$Display()
# and this would send it:
new_mail$Send()
Dear maintainer,
I am looking for a way to store created emails to a 'Drafts' folder of an arbitrary account in MS Outlook. The situation is that I have access to several email accounts in Outlook and want to send larger numbers of emails from a specific account. However, before sending I would like to review the created emails in the Drafts folder and then send from there.
Is there a way to do it?