Re: Detect Undeliverable Email using WebDAV?
- From: "Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx>
- Date: Mon, 6 Feb 2006 13:27:41 -0800
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
- Follow-Ups:
- Re: Detect Undeliverable Email using WebDAV?
- From: Glen Scales [MVP]
- Re: Detect Undeliverable Email using WebDAV?
- References:
- Re: Detect Undeliverable Email using WebDAV?
- From: Glen Scales [MVP]
- Re: Detect Undeliverable Email using WebDAV?
- From: Li Weng
- Re: Detect Undeliverable Email using WebDAV?
- From: Glen Scales [MVP]
- Re: Detect Undeliverable Email using WebDAV?
- From: Li Weng
- Re: Detect Undeliverable Email using WebDAV?
- From: Li Weng
- Re: Detect Undeliverable Email using WebDAV?
- From: Glen Scales [MVP]
- Re: Detect Undeliverable Email using WebDAV?
- From: Li Weng
- Re: Detect Undeliverable Email using WebDAV?
- From: Henning Krause [MVP]
- Re: Detect Undeliverable Email using WebDAV?
- Prev by Date: Re: Detect Undeliverable Email using WebDAV?
- Next by Date: Re: Detect Undeliverable Email using WebDAV?
- Previous by thread: Re: Detect Undeliverable Email using WebDAV?
- Next by thread: Re: Detect Undeliverable Email using WebDAV?
- Index(es):
Relevant Pages
|
Loading