Re: Detect Undeliverable Email using WebDAV?



The text you get back is in a serialized structured format documented in
those RFC's that Henning mentioned. So you can write your own parser to
separated out all the bodyparts of the message have a look at
http://www.akadia.com/services/email_attachments_using_perl.html which gives
a good explanation on how message body parts are divided.

There's nothing that I know of that will covert these body parts to XML you
could use the OWA open command but this will just send back browser
formatted text which would need to parse also.

I used CDOSYS because its easy to load a message in a serialized format and
it will handle all the parsing for you because it understand all the RFC's,
in .NET system.web.mail is a wrapper of CDOSYS but unfortunately they only
wrapped a subset of it functionality. (In .NET 2.0 there is System.NET.mail
and System.NET.MIME which look at lot more encouraging).

Cheers
Glen

"Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx> wrote in message
news:323B4152-2016-4EFF-BD0F-A756D42055B4@xxxxxxxxxxxxxxxx
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?
    ... I can use xmldocument to load and parse it. ... My question is besides CDOSYS, is there another method to parse it or can I ... 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: Pretty printing experts, pretty please?
    ... T _is_ a stream designator for terminal I/O, but FORMAT does not ... streams for *terminal-io*, and because the LispM had windowing, every window ...
    (comp.lang.lisp)
  • Re: Data table text I/O package?
    ... regular and homogenuous data in mind. ... Given a data format much like in, ... I said XML is good for parsing of data if you cannot tell in advance that the data stream is totally free of errors. ... However, if some data item contains a separator due to an error, you loose the whole stream, or use the wrong data without noticing this, in the worst case. ...
    (comp.lang.ada)