Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email string to CDO Message object
Message
 
 
To
24/11/2004 10:11:55
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00964291
Message ID:
00964520
Views:
49
Hi Steve,

Below is a piece of code I use to load email message from the file or memory into CDO 2000 Message object. The trick for load from the memory is to load it as a binary not text.
loStm = CREATEOBJECT("ADODB.Stream")
loMsg = CREATEOBJECT("CDO.Message")
IF llFileName
	loStm.LoadFromFile(tcTextOrFileName)
ELSE
	loStm.Type = 1  && adTypeBinary
	loStm.Write(CREATEBINARY(tcTextOrFileName))
	loStm.SetEos()
ENDIF	

loDsrc = loMsg.DataSource
loDsrc.OpenObject(loStm, "_Stream")
...

>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?
>
>
<snip>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform