Re: Detect Undeliverable Email using WebDAV?



Hi, Henning:

Thanks for your information. My question is if there is a method to parse
this format and get back the related fields? eg, how to get just message body?

If it's a xml, I can use xmldocument to load and parse it. From below, Glen
used CDOSYS to load and parse it.

My question is besides CDOSYS, is there another method to parse it or can I
convert it to xml? Or CDOSYS is the only way to do it?

Thanks.

Li

"Henning Krause [MVP]" wrote:

Hello,

the response upon a GET command is the entire email which is formatted
according to RFC 2822 (http://www.ietf.org/rfc/rfc2822.txt) and RFC 1521
(http://www.faqs.org/rfcs/rfc1521.html)

Greetings,
Henning Krause


"Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx> wrote in message
news:973C0631-5596-4FF6-9B3F-192AFA9CCCB3@xxxxxxxxxxxxxxxx
Hi, Glen:

Thanks a lot for your help! Yes, I can use "Get" to get all messages I
want!
Now the only problem is the response stream is not in xml format. how do I
parse the stream?

In your example you use CDOSYS as a parser. Do I have to involve CDOSYS
just
for the parsing? Can I get or convert the stream into xml?

I used:
--------------------------------------------------------------------------
Dim Request As HttpWebRequest
Request = CType(System.Net.WebRequest.Create(strEmailURI),
System.Net.HttpWebRequest)
Request.Credentials = MyCredentialCache
Request.Method = "Get"

Request.ContentType = "text/xml"
Request.Headers.Add("Translate", "F")
---------------------------------------------------------------------------------

And the response stream:
---------------------------------------------------------------------------------------
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Received: by MAILSRV.PUC.STATE.OH.US
id <01C62740.B75073B1@xxxxxxxxxxxxxxxxxxxxxxx>; Wed, 1 Feb 2006 10:03:53
-0500
MIME-Version: 1.0
Content-Type: multipart/report;
report-type=delivery-status;
boundary="----_=_NextPart_001_01C62740.B75073B1"
x-dsncontext: 335a7efd - 4523 - 00000001 - 80040546
Content-class: urn:content-classes:dsn
Subject: Undeliverable:10:03. 2/1/06
Date: Wed, 1 Feb 2006 10:03:53 -0500
Message-ID: <c4z7uSJSO00000254@xxxxxxxxxxxxxxxxxxxxxxx>
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
Thread-Topic: 10:03. 2/1/06
thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
From: "System Administrator" <postmaster@xxxxxxxxxxxxxxx>
To: "Student11" <Student11@xxxxxxxxxxxxxxx>

This is a multi-part message in MIME format.

------_=_NextPart_001_01C62740.B75073B1
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Your message

To: To_aaaaaaaaaaaaaaaaaaaa@xxxxxxxxxxxxxxx; Weng, Li;
To_3333333333333@xxxxxxxxxxxxxxx
Cc: CC_cccccccccccccccccccccccc@xxxxxxxxxxxxxxx
Subject: 10:03. 2/1/06
Sent: Wed, 1 Feb 2006 10:03:53 -0500

did not reach the following recipient(s):
...
-------------------------------------------------------------------------------------

Thanks.

Li


"Glen Scales [MVP]" wrote:

Generally MAPI isn't supported in .NET (but the Outlook Object Model
which
uses Mapi is) so if you want to use MAPI from .NET create a COM object in
C++ with your extended MAPI code and then just invoke the different
functions you want from your managed code. There's at least one third
party
wrapper for Extended Mapi that i know of called Mapi33.

On Second look the Text itself is in the message stream stored in
seperate
bodyparts (which X-MS-ENUMATTS doesn't enumerate) so if you get the
message
Stream with WebDAV using a Get you can then parse the content back out of
the responsestream. eg this is a quick sample using CDOEX/CDOSYS as the
parser.

href = "http://server/exchange/mailbox/Inbox/Undeliverable:blah.EML";
set req = createobject("microsoft.xmlhttp")
req.open "GET", href, false
req.setRequestHeader "Translate","f"
req.send
set stm = createobject("ADODB.Stream")
stm.open
msgstring = req.responsetext
rem wscript.echo msgstring
stm.type = 2
stm.Charset = "x-ansi"
stm.writetext msgstring,0
stm.Position = 0
stm.type = 1
set msgobj = createobject("CDO.Message")
msgobj.datasource.openobject stm,"_Stream"
wscript.echo msgobj.fields("urn:schemas:httpmail:textdescription")
set objbparts = msgobj.bodypart.bodyparts
for each objbpart in objbparts
if objbpart.ContentMediaType = "message/delivery-status" then
wscript.echo objbpart.getstream.readtext
end if
next

Cheers
Glen




.



Relevant Pages

  • Re: Detect Undeliverable Email using WebDAV?
    ... formatted text which would need to parse also. ... in .NET system.web.mail is a wrapper of CDOSYS but unfortunately they only ... this format and get back the related fields? ... Now the only problem is the response stream is not in xml format. ...
    (microsoft.public.exchange2000.development)
  • Re: Detect Undeliverable Email using WebDAV?
    ... formatted text which would need to parse also. ... I used CDOSYS because its easy to load a message in a serialized format and ... in .NET system.web.mail is a wrapper of CDOSYS but unfortunately they only ... Now the only problem is the response stream is not in xml format. ...
    (microsoft.public.exchange2000.development)
  • Re: Cant get message body using WebDav for undeliverable e-mail reports
    ... You should be able to use CDOSYS via a Com Interop in vS2005 its ... the best mime parser around I still use in VS 2005 with the new Exchange Web ... serialized text stream so you could build your own helper class to parse it ... but I can't figure out how to parse the stream to ...
    (microsoft.public.exchange2000.development)
  • Re: REGEXPS
    ... the meaning and purpose of it 4) if you need to change parse ... > format it's easily and quickly done. ... > unless you commented it and if you need to changes input format it ... Considering that regexps quite popular ...
    (comp.lang.lisp)
  • Re: Custom EDI Receive Pipeline Component advice
    ... Wrap the message stream in your own stream, hook to the read event and wait ... found that I will need to modify the message in the pipeline before it ... The gist of it is I need to change the receiver ... load it up and parse through the message to ...
    (microsoft.public.biztalk.general)

Loading