Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email string to CDO Message object
Message
From
24/11/2004 10:11:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Email string to CDO Message object
Miscellaneous
Thread ID:
00964291
Message ID:
00964291
Views:
161
I want to take a base64 encoded email message string into a CDO.Message object. I have succeeded when I store the decoded string into a file and used the CDO DropDirectory GetMessages method (see below). However, I would like to bypass writing the string out to a file and read it more directly into a CDO.Message.

It appears that the string has to be inserted into the message object via an ADO stream object. The OpenObject method is on the IDataSource interface of the Message object, so I tried the code below.
   cMsg = strConv(cEncodedString,14)
   oStream = CreateObject("ADODB.Stream")
   oStream.Open()
   oStream.WriteText(cMsg)
   oMsg = CREATEOBJECT("CDO.Message")
   oMsg.DataSource.OpenObject(oStream,"_Stream")
   cTo = oMsg.To
So far the oMsg object seems to be ignoring my attempt the import the email string. All the important properties of oMsg are emtpy. Does anybody out there know how to achieve getting the email string into the Message object?


If I use strConv to decode the base64 string and save the result to a file with an eml extension, I can use the CDO objects in Windows to get the email into a CDO message object. E.G.
oDropDir = CREATEOBJECT("CDO.DropDirectory")
oMsgs = oDropDir.GetMessages("C:\temp")
FOR EACH oMsg IN oMsgs
   cTo = oMsg.To
   nRecipients = ALINES(laRecipients,cTo,.T.,",",";")
   FOR EACH lcRecipient IN laRecipients
      ? lcRecipient
   ENDFOR
   * other processing on oMsg
ENDFOR
Next
Reply
Map
View

Click here to load this message in the networking platform