How to convert a MIME string to a CDO.Message
- From: "John Mark Howell" <jmarkhowell@xxxxxxxxxxx>
- Date: Mon, 26 Sep 2005 14:28:57 -0500
I have a string containing a MIME encoded email and I need to convert it to
a CDO.Message object. I can currently convert it by saving it to a file,
then opening an ADO.Stream using LoadFromFile and then using the
CDO.Message.DataSource.OpenObject to load the stream. I would like to not
have to save it to a file. Here's the code I'm playing with but does not
work (the CDO.Message object is empty).
' buf contains the MIME encoded email string
Public Sub TestWithString(ByVal buf As String)
' now build the ADODB.Stream object
Dim so As New ADODB.Stream
so.Mode = ConnectModeEnum.adModeReadWrite
so.Type = StreamTypeEnum.adTypeText
so.Open()
' fill the stream with the text
so.WriteText(buf, StreamWriteEnum.adWriteLine)
' reset the position in the stream
so.Position = 0
' now build the CDO message
Dim msg As New CDO.Message
msg.DataSource.OpenObject(so, "_Stream")
' just to test it
Console.WriteLine(msg.From)
Console.WriteLine(msg.TextBody)
End Sub
.
- Follow-Ups:
- Re: How to convert a MIME string to a CDO.Message
- From: Glen Scales [MVP]
- Re: How to convert a MIME string to a CDO.Message
- Prev by Date: New Msg: CDO "From" Field
- Next by Date: Setting exchange appointment COLOR using webdav
- Previous by thread: New Msg: CDO "From" Field
- Next by thread: Re: How to convert a MIME string to a CDO.Message
- Index(es):
Relevant Pages
|
|