Preferably, I would like to save it to an eml/msg file after it has been sent. I can probably get the message using mailReadMessage to get it into a mailMessage object with the proper ID.
But I can't find a way to save it to a disk file.
Preferably, I would like to save it to an eml/msg file after it has been sent. I can probably get the message using mailReadMessage to get it into a mailMessage object with the proper ID.
But I can't find a way to save it to a disk file.
First :
oleobject lole_folder, iole_outlook, lole_sent_email, ol_NS
li_ole_result = iole_outlook.ConnectToObject("","outlook.application")
ol_NS = iole_outlook.getnamespace('MAPI')
ol_NS.Logon('', '', true, true) //required?
<create and send message here>
...
lole_folder = ol_NS.getdefaultfolder(5) // sent folder
<create filter information in ls_filter>
lole_sent_email = lole_folder.items.find(ls_filter) // possibly repeat some times with sleep() function
...
ls_email = "c:\temp\sentmailtest.msg"
lole_sent_email.saveas(ls_email)
The trick was to find the proper sent email message in the outbox folder. I fixed that by setting some random value to the [BillingInformation] property of the sent message, and then using that in the filter method.