A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Messages sent using CDO arriving as text



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 15th 06, 05:26 PM posted to microsoft.public.outlook.program_vba
Danila
external usenet poster
 
Posts: 1
Default Messages sent using CDO arriving as text

Hi.
I need to write an application that takes messages from exchange mailfolder,
saves them to xml file,
then loads the messages from file into another exchange folder and finally
sends these messages to receipients.

I use adodb to read the messages into recordset and then for each record, Im
writing the message stream
(rec.Fields(-1)) into xml file.
Then I open empty record in target URL and update message stream using the
same idea

When I open the message in target folder using outlook it seems identical to
original message.

After that, I once again read the message stream and load it into
CDO.IDataSource object,
and send it to receipients.

When message arrives it looks like this:
‏X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: by _________.vnc.com id ;
Mon, 15 May 2006 13:33:19 +0200
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----_=_NextPart_001_01C67813.5D3D5490"
Content-class: urn:content-classes:message
Subject: black red 10
Message-ID:
Date: Mon, 15 May 2006 13:50:01 +0200
Content-Transfer-Encoding: 7bit
X-MS-Has-Attach: yes
X-Mailer: Microsoft CDO for Windows 2000
X-MS-TNEF-Correlator:
Thread-Topic: black red 10
Thread-Index: AcZ4E10CZK3iJLQRRxSq4hpXE0DrJQ==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663
From: "Daniel Sokolov"
Importance: normal
To: "Daniel Sokolov"
Priority: normal

This is a multi-part message in MIME format.

------_=_NextPart_001_01C67813.5D3D5490
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns=3D"urn:schemas-microsoft-comfficeffice" =
xmlns:w=3D"urn:schemas-microsoft-comffice:word" =
xmlns:st1=3D"urn:schemas-microsoft-comffice:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40"
.....................

I include the functions I use to accomplish the above:

'Puts Updates empty message in target URL
Private Sub SetBinaryData(ByVal xmlnodeMsg As XmlNode, ByRef recMsg As
ADODB.Record)
Dim xmlData As XmlCDataSection =
CType(xmlnodeMsg.SelectSingleNode("BinaryData").Fi rstChild, XmlCDataSection)
Dim dataStream As ADODB.Stream
Dim str As String
Try
dataStream = recMsg.Fields(-1).Value
str = xmlData.Data
dataStream.WriteText(str)
recMsg.Fields(-1).Value = dataStream
System.Diagnostics.EventLog.WriteEntry(Me.GetType( ).ToString(),
"SetBinaryData:BinaryData Successfully Updated")
Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry(Me.GetType( ).ToString(),
ex.Message)
End Try
End Sub


Private Sub SendMail(ByVal recMsg As ADODB.Record, ByVal username As
String, ByVal password As String, ByVal logger As Logger)
Dim streamMsg As ADODB.Stream
Dim iMsg As New CDO.Message
Dim iDsrc As CDO.IDataSource
Dim iConf As CDO.Configuration
Try
iConf = New CDO.Configuration
iConf.Fields( _

"http://schemas.microsoft.com/cdo/configuration/sendusing" _
).Value = CDO.CdoSendUsing.cdoSendUsingPickup
streamMsg = New ADODB.Stream
streamMsg.Open(recMsg, ADODB.ConnectModeEnum.adModeRead _
, ADODB.StreamOpenOptionsEnum.adOpenStreamFromRecord _
, username, password)

iMsg.Configuration = iConf
iDsrc = iMsg
iDsrc.OpenObject(streamMsg, CDO.CdoInterfaces.cdoIStream)
iMsg.AutoGenerateTextBody = False
iMsg.MimeFormatted = True

iMsg.BodyPart.ContentClass = "urn:content-classes:message"
iMsg.BodyPart.ContentMediaType =
CDO.CdoContentTypeValues.cdoMultipartRelated
iMsg.Send()


Catch ex As Exception
logger.WriteException(ex, Me.GetType().Assembly)
End Try

End Sub

Please, Help
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script errors arriving in email? Dick Outlook Express 9 May 23rd 07 12:55 PM
Switching identities, emails sent but not arriving Stan Outlook Express 1 April 20th 06 11:06 PM
Missing text in messages RG Outlook Express 1 March 31st 06 05:45 PM
Plain text messages are not readable. Jim Outlook - Installation 2 March 2nd 06 06:15 PM
Why are some messages missing it's text? chanin111 Outlook - General Queries 0 January 8th 06 04:04 AM


All times are GMT +1. The time now is 11:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2025 Outlook Banter.
The comments are property of their posters.