1. Sverre Tvedt
  2. PowerBuilder
  3. Thursday, 27 August 2020 12:57 PM UTC

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.

Accepted Answer
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 27 August 2020 23:44 PM UTC
  2. PowerBuilder
  3. # Permalink

If you use OLE to run a more complex mail app, like Outlook, that tool may have an otion to SAVE TO DISK.

Here's the link to the Outlook MAil REST API reference document

This commnad saves a message into a folder

Later -


  1. Sverre Tvedt
  2. Friday, 28 August 2020 06:21 AM UTC
Yes, I found a way using OLE:

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"


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.

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 27 August 2020 22:06 PM UTC
  2. PowerBuilder
  3. # 1

MAPI was designed as an interface to messaging applications and as such, it appears to lack the kind of functionality you are seeking. I briefly scanned Microsoft's MAPI documentation and saw no function or method to save a message as a file. As you have stated, I think you will need to grab the message information via the PB mailMessage object and write it to a file on your own. I would surmise there is documentation on the web that describes the .eml format.

Not what you were hoping to hear, I'm sure. Good luck!

  1. Sverre Tvedt
  2. Friday, 28 August 2020 06:22 AM UTC
See my reply to Olan.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.