|
|
|
date: Tue, 31 Jan 2006 07:45:30 -0800,
group: microsoft.public.exchange2000.development
back
Re: Detect Undeliverable Email using WebDAV?
Hi, Glen:
I can get my original email (yes, it's as an attachment). The problem is I
want to get the system's message, i.e.,
"Your message did not reach some or all of the intended recipients. ..."
In order word, I want to get nondelivery report contents, especially which
email addresses are undeliverable, using WebDAV.
Thanks.
Li
"Glen Scales [MVP]" wrote:
> The original message (if it is there) is stored as a separate body part on
> the message. Depending on what API your using in CDOEX you can get this by
> just looping though the attachments collection and looking for a message
> with a content type of RFC/822 eg
>
> set msgobj = createobject("CDO.Message")
> msgobj.datasource.open Href,oCon,3
> set objattachments = msgobj.attachments
> for each objattachment in objattachments
> if objAttachment.ContentMediaType = "message/rfc822" then
> set msgobj1 = createobject("cdo.message")
> msgobj1.datasource.OpenObject objattachment, "ibodypart"
> exit for
> end if
> next
>
> In WebDAV you should be able to do something simular with the X-MS-ENUMATTS
> Method or just get the whole message stream and parse it out yourself.
>
> Cheers
> Glen
>
> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
> news:67771CC2-3969-44C1-A839-BF4E872467D8@microsoft.com...
> > Hi,
> >
> > I saw the discussion about "Detect Undeliverable Email using WebDAV" by
> > Frank and Glen. I had the similar problem and I also want to get the
> > Undeliverable email body, i.e.,
> >
> > "Your message did not reach some or all of the intended recipients.
> > Subject: 11:46. 1/26/06.
> > Sent: 1/26/2006 11:47 AM
> > The following recipient(s) could not be reached: ... "
> >
> > What property holds it? htmldescription and textdescription properties
> > don't
> > exist for Undeliverable email from Exchange. In other word, how to get
> > this
> > Nondelivery report contents?
> >
> > Thanks in advance.
> >
> > Li
> >
>
>
>
date: Wed, 1 Feb 2006 05:45:26 -0800
author: Li Weng am
Re: Detect Undeliverable Email using WebDAV?
This information is stored in the Recipients table of the message in the
PR_NDR_STATUS_CODE , PR_REPORT_TEXT fields (if you have a look at a NDR in
Outlook Spy or Mdbvu32 you can see these fields). I don't believe there is
anyway to access the Recipients table via WebDAV the only way is to use
MAPI.
Cheers
Glen
"Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
news:FCE825A0-87F9-480B-873F-91BD5E7921DE@microsoft.com...
> Hi, Glen:
>
> I can get my original email (yes, it's as an attachment). The problem is I
> want to get the system's message, i.e.,
>
> "Your message did not reach some or all of the intended recipients. ..."
>
> In order word, I want to get nondelivery report contents, especially which
> email addresses are undeliverable, using WebDAV.
>
> Thanks.
>
> Li
>
> "Glen Scales [MVP]" wrote:
>
>> The original message (if it is there) is stored as a separate body part
>> on
>> the message. Depending on what API your using in CDOEX you can get this
>> by
>> just looping though the attachments collection and looking for a message
>> with a content type of RFC/822 eg
>>
>> set msgobj = createobject("CDO.Message")
>> msgobj.datasource.open Href,oCon,3
>> set objattachments = msgobj.attachments
>> for each objattachment in objattachments
>> if objAttachment.ContentMediaType = "message/rfc822" then
>> set msgobj1 = createobject("cdo.message")
>> msgobj1.datasource.OpenObject objattachment, "ibodypart"
>> exit for
>> end if
>> next
>>
>> In WebDAV you should be able to do something simular with the
>> X-MS-ENUMATTS
>> Method or just get the whole message stream and parse it out yourself.
>>
>> Cheers
>> Glen
>>
>> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
>> news:67771CC2-3969-44C1-A839-BF4E872467D8@microsoft.com...
>> > Hi,
>> >
>> > I saw the discussion about "Detect Undeliverable Email using WebDAV" by
>> > Frank and Glen. I had the similar problem and I also want to get the
>> > Undeliverable email body, i.e.,
>> >
>> > "Your message did not reach some or all of the intended recipients.
>> > Subject: 11:46. 1/26/06.
>> > Sent: 1/26/2006 11:47 AM
>> > The following recipient(s) could not be reached: ... "
>> >
>> > What property holds it? htmldescription and textdescription properties
>> > don't
>> > exist for Undeliverable email from Exchange. In other word, how to get
>> > this
>> > Nondelivery report contents?
>> >
>> > Thanks in advance.
>> >
>> > Li
>> >
>>
>>
>>
date: Thu, 2 Feb 2006 09:45:20 +1100
author: Glen Scales [MVP]
Re: Detect Undeliverable Email using WebDAV?
I may not make my question clear.
What I meant is that MAPI is NOT supported by Microsoft for Exchange APIs
with .NET Framework Applications from Article 813349. It also stated "If the
..NET application assemblies do not reside directly on the Exchange Server,
Microsoft recommends using WebDAV."
That's why we implemented WebDAV in our application. Now we have this
problem that Undeliverable emails can't be retrieved via WebDAV. Could
Microsoft provide a way to at least workaround it?
Thanks.
Li
"Li Weng" wrote:
> Hi, Glen:
>
> To my knowledge, MAPI can only be used within the Exchange server. right?
> Generally speaking, if an application in another server wants to retrieve
> all emails of an account in an Exchange server, how can it retrieve
> Undeliverable emails?
>
> Thanks.
> Li
>
> "Glen Scales [MVP]" wrote:
>
> > This information is stored in the Recipients table of the message in the
> > PR_NDR_STATUS_CODE , PR_REPORT_TEXT fields (if you have a look at a NDR in
> > Outlook Spy or Mdbvu32 you can see these fields). I don't believe there is
> > anyway to access the Recipients table via WebDAV the only way is to use
> > MAPI.
> >
> > Cheers
> > Glen
> >
> > "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
> > news:FCE825A0-87F9-480B-873F-91BD5E7921DE@microsoft.com...
> > > Hi, Glen:
> > >
> > > I can get my original email (yes, it's as an attachment). The problem is I
> > > want to get the system's message, i.e.,
> > >
> > > "Your message did not reach some or all of the intended recipients. ..."
> > >
> > > In order word, I want to get nondelivery report contents, especially which
> > > email addresses are undeliverable, using WebDAV.
> > >
> > > Thanks.
> > >
> > > Li
> > >
> > > "Glen Scales [MVP]" wrote:
> > >
> > >> The original message (if it is there) is stored as a separate body part
> > >> on
> > >> the message. Depending on what API your using in CDOEX you can get this
> > >> by
> > >> just looping though the attachments collection and looking for a message
> > >> with a content type of RFC/822 eg
> > >>
> > >> set msgobj = createobject("CDO.Message")
> > >> msgobj.datasource.open Href,oCon,3
> > >> set objattachments = msgobj.attachments
> > >> for each objattachment in objattachments
> > >> if objAttachment.ContentMediaType = "message/rfc822" then
> > >> set msgobj1 = createobject("cdo.message")
> > >> msgobj1.datasource.OpenObject objattachment, "ibodypart"
> > >> exit for
> > >> end if
> > >> next
> > >>
> > >> In WebDAV you should be able to do something simular with the
> > >> X-MS-ENUMATTS
> > >> Method or just get the whole message stream and parse it out yourself.
> > >>
> > >> Cheers
> > >> Glen
> > >>
> > >> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
> > >> news:67771CC2-3969-44C1-A839-BF4E872467D8@microsoft.com...
> > >> > Hi,
> > >> >
> > >> > I saw the discussion about "Detect Undeliverable Email using WebDAV" by
> > >> > Frank and Glen. I had the similar problem and I also want to get the
> > >> > Undeliverable email body, i.e.,
> > >> >
> > >> > "Your message did not reach some or all of the intended recipients.
> > >> > Subject: 11:46. 1/26/06.
> > >> > Sent: 1/26/2006 11:47 AM
> > >> > The following recipient(s) could not be reached: ... "
> > >> >
> > >> > What property holds it? htmldescription and textdescription properties
> > >> > don't
> > >> > exist for Undeliverable email from Exchange. In other word, how to get
> > >> > this
> > >> > Nondelivery report contents?
> > >> >
> > >> > Thanks in advance.
> > >> >
> > >> > Li
> > >> >
> > >>
> > >>
> > >>
> >
> >
> >
date: Thu, 2 Feb 2006 07:29:12 -0800
author: Li Weng am
Re: Detect Undeliverable Email using WebDAV?
Hi, Glen:
To my knowledge, MAPI can only be used within the Exchange server. right?
Generally speaking, if an application in another server wants to retrieve
all emails of an account in an Exchange server, how can it retrieve
Undeliverable emails?
Thanks.
Li
"Glen Scales [MVP]" wrote:
> This information is stored in the Recipients table of the message in the
> PR_NDR_STATUS_CODE , PR_REPORT_TEXT fields (if you have a look at a NDR in
> Outlook Spy or Mdbvu32 you can see these fields). I don't believe there is
> anyway to access the Recipients table via WebDAV the only way is to use
> MAPI.
>
> Cheers
> Glen
>
> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
> news:FCE825A0-87F9-480B-873F-91BD5E7921DE@microsoft.com...
> > Hi, Glen:
> >
> > I can get my original email (yes, it's as an attachment). The problem is I
> > want to get the system's message, i.e.,
> >
> > "Your message did not reach some or all of the intended recipients. ..."
> >
> > In order word, I want to get nondelivery report contents, especially which
> > email addresses are undeliverable, using WebDAV.
> >
> > Thanks.
> >
> > Li
> >
> > "Glen Scales [MVP]" wrote:
> >
> >> The original message (if it is there) is stored as a separate body part
> >> on
> >> the message. Depending on what API your using in CDOEX you can get this
> >> by
> >> just looping though the attachments collection and looking for a message
> >> with a content type of RFC/822 eg
> >>
> >> set msgobj = createobject("CDO.Message")
> >> msgobj.datasource.open Href,oCon,3
> >> set objattachments = msgobj.attachments
> >> for each objattachment in objattachments
> >> if objAttachment.ContentMediaType = "message/rfc822" then
> >> set msgobj1 = createobject("cdo.message")
> >> msgobj1.datasource.OpenObject objattachment, "ibodypart"
> >> exit for
> >> end if
> >> next
> >>
> >> In WebDAV you should be able to do something simular with the
> >> X-MS-ENUMATTS
> >> Method or just get the whole message stream and parse it out yourself.
> >>
> >> Cheers
> >> Glen
> >>
> >> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
> >> news:67771CC2-3969-44C1-A839-BF4E872467D8@microsoft.com...
> >> > Hi,
> >> >
> >> > I saw the discussion about "Detect Undeliverable Email using WebDAV" by
> >> > Frank and Glen. I had the similar problem and I also want to get the
> >> > Undeliverable email body, i.e.,
> >> >
> >> > "Your message did not reach some or all of the intended recipients.
> >> > Subject: 11:46. 1/26/06.
> >> > Sent: 1/26/2006 11:47 AM
> >> > The following recipient(s) could not be reached: ... "
> >> >
> >> > What property holds it? htmldescription and textdescription properties
> >> > don't
> >> > exist for Undeliverable email from Exchange. In other word, how to get
> >> > this
> >> > Nondelivery report contents?
> >> >
> >> > Thanks in advance.
> >> >
> >> > Li
> >> >
> >>
> >>
> >>
>
>
>
date: Thu, 2 Feb 2006 07:32:13 -0800
author: Li Weng am
Re: Detect Undeliverable Email using WebDAV?
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
"Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
news:B1B41D49-B157-4033-BED0-7B3A85741ECF@microsoft.com...
>I may not make my question clear.
> What I meant is that MAPI is NOT supported by Microsoft for Exchange APIs
> with .NET Framework Applications from Article 813349. It also stated "If
> the
> .NET application assemblies do not reside directly on the Exchange Server,
> Microsoft recommends using WebDAV."
>
> That's why we implemented WebDAV in our application. Now we have this
> problem that Undeliverable emails can't be retrieved via WebDAV.
>
> Thanks.
>
> Li
>
> "Li Weng" wrote:
>
>> Hi, Glen:
>>
>> To my knowledge, MAPI can only be used within the Exchange server. right?
>> Generally speaking, if an application in another server wants to retrieve
>> all emails of an account in an Exchange server, how can it retrieve
>> Undeliverable emails?
>>
>> Thanks.
>> Li
>>
>> "Glen Scales [MVP]" wrote:
>>
>> > This information is stored in the Recipients table of the message in
>> > the
>> > PR_NDR_STATUS_CODE , PR_REPORT_TEXT fields (if you have a look at a NDR
>> > in
>> > Outlook Spy or Mdbvu32 you can see these fields). I don't believe there
>> > is
>> > anyway to access the Recipients table via WebDAV the only way is to use
>> > MAPI.
>> >
>> > Cheers
>> > Glen
>> >
>> > "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
>> > news:FCE825A0-87F9-480B-873F-91BD5E7921DE@microsoft.com...
>> > > Hi, Glen:
>> > >
>> > > I can get my original email (yes, it's as an attachment). The problem
>> > > is I
>> > > want to get the system's message, i.e.,
>> > >
>> > > "Your message did not reach some or all of the intended recipients.
>> > > ..."
>> > >
>> > > In order word, I want to get nondelivery report contents, especially
>> > > which
>> > > email addresses are undeliverable, using WebDAV.
>> > >
>> > > Thanks.
>> > >
>> > > Li
>> > >
>> > > "Glen Scales [MVP]" wrote:
>> > >
>> > >> The original message (if it is there) is stored as a separate body
>> > >> part
>> > >> on
>> > >> the message. Depending on what API your using in CDOEX you can get
>> > >> this
>> > >> by
>> > >> just looping though the attachments collection and looking for a
>> > >> message
>> > >> with a content type of RFC/822 eg
>> > >>
>> > >> set msgobj = createobject("CDO.Message")
>> > >> msgobj.datasource.open Href,oCon,3
>> > >> set objattachments = msgobj.attachments
>> > >> for each objattachment in objattachments
>> > >> if objAttachment.ContentMediaType = "message/rfc822" then
>> > >> set msgobj1 = createobject("cdo.message")
>> > >> msgobj1.datasource.OpenObject objattachment, "ibodypart"
>> > >> exit for
>> > >> end if
>> > >> next
>> > >>
>> > >> In WebDAV you should be able to do something simular with the
>> > >> X-MS-ENUMATTS
>> > >> Method or just get the whole message stream and parse it out
>> > >> yourself.
>> > >>
>> > >> Cheers
>> > >> Glen
>> > >>
>> > >> "Li Weng" <wlwlwlwl@newsgroup.nospam> wrote in message
>> > >> news:67771CC2-3969-44C1-A839-BF4E872467D8@microsoft.com...
>> > >> > Hi,
>> > >> >
>> > >> > I saw the discussion about "Detect Undeliverable Email using
>> > >> > WebDAV" by
>> > >> > Frank and Glen. I had the similar problem and I also want to get
>> > >> > the
>> > >> > Undeliverable email body, i.e.,
>> > >> >
>> > >> > "Your message did not reach some or all of the intended
>> > >> > recipients.
>> > >> > Subject: 11:46. 1/26/06.
>> > >> > Sent: 1/26/2006 11:47 AM
>> > >> > The following recipient(s) could not be reached: ... "
>> > >> >
>> > >> > What property holds it? htmldescription and textdescription
>> > >> > properties
>> > >> > don't
>> > >> > exist for Undeliverable email from Exchange. In other word, how to
>> > >> > get
>> > >> > this
>> > >> > Nondelivery report contents?
>> > >> >
>> > >> > Thanks in advance.
>> > >> >
>> > >> > Li
>> > >> >
>> > >>
>> > >>
>> > >>
>> >
>> >
>> >
date: Fri, 3 Feb 2006 11:42:53 +1100
author: Glen Scales [MVP]
Re: Detect Undeliverable Email using WebDAV?
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 ; 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:
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
Thread-Topic: 10:03. 2/1/06
thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
From: "System Administrator"
To: "Student11"
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@puc.state.oh.us; Weng, Li;
To_3333333333333@puc.state.oh.us
Cc: CC_cccccccccccccccccccccccc@puc.state.oh.us
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
date: Mon, 6 Feb 2006 07:09:19 -0800
author: Li Weng am
Re: Detect Undeliverable Email using WebDAV?
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@newsgroup.nospam> wrote in message
news:973C0631-5596-4FF6-9B3F-192AFA9CCCB3@microsoft.com...
> 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 ; 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:
> X-MS-Has-Attach: yes
> X-MS-TNEF-Correlator:
> Thread-Topic: 10:03. 2/1/06
> thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
> From: "System Administrator"
> To: "Student11"
>
> 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@puc.state.oh.us; Weng, Li;
> To_3333333333333@puc.state.oh.us
> Cc: CC_cccccccccccccccccccccccc@puc.state.oh.us
> 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
>
date: Mon, 6 Feb 2006 16:44:35 +0100
author: Henning Krause [MVP]
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@newsgroup.nospam> wrote in message
> news:973C0631-5596-4FF6-9B3F-192AFA9CCCB3@microsoft.com...
> > 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 ; 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:
> > X-MS-Has-Attach: yes
> > X-MS-TNEF-Correlator:
> > Thread-Topic: 10:03. 2/1/06
> > thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
> > From: "System Administrator"
> > To: "Student11"
> >
> > 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@puc.state.oh.us; Weng, Li;
> > To_3333333333333@puc.state.oh.us
> > Cc: CC_cccccccccccccccccccccccc@puc.state.oh.us
> > 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
> >
>
>
>
date: Mon, 6 Feb 2006 13:27:41 -0800
author: Li Weng am
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@newsgroup.nospam> wrote in message
news:323B4152-2016-4EFF-BD0F-A756D42055B4@microsoft.com...
> 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@newsgroup.nospam> wrote in message
>> news:973C0631-5596-4FF6-9B3F-192AFA9CCCB3@microsoft.com...
>> > 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 ; 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:
>> > X-MS-Has-Attach: yes
>> > X-MS-TNEF-Correlator:
>> > Thread-Topic: 10:03. 2/1/06
>> > thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
>> > From: "System Administrator"
>> > To: "Student11"
>> >
>> > 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@puc.state.oh.us; Weng, Li;
>> > To_3333333333333@puc.state.oh.us
>> > Cc: CC_cccccccccccccccccccccccc@puc.state.oh.us
>> > 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
>> >
>>
>>
>>
date: Tue, 7 Feb 2006 09:19:22 +1100
author: Glen Scales [MVP]
Re: Detect Undeliverable Email using WebDAV?
Hi, Glen:
Thanks a lot!
Li
"Glen Scales [MVP]" wrote:
> 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@newsgroup.nospam> wrote in message
> news:323B4152-2016-4EFF-BD0F-A756D42055B4@microsoft.com...
> > 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@newsgroup.nospam> wrote in message
> >> news:973C0631-5596-4FF6-9B3F-192AFA9CCCB3@microsoft.com...
> >> > 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 ; 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:
> >> > X-MS-Has-Attach: yes
> >> > X-MS-TNEF-Correlator:
> >> > Thread-Topic: 10:03. 2/1/06
> >> > thread-index: AcYnQLcUiDdWeEfbQ6qLYXmHPUSw+gAAAA86
> >> > From: "System Administrator"
> >> > To: "Student11"
> >> >
> >> > 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@puc.state.oh.us; Weng, Li;
> >> > To_3333333333333@puc.state.oh.us
> >> > Cc: CC_cccccccccccccccccccccccc@puc.state.oh.us
> >> > 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
> >> >
> >>
> >>
> >>
>
>
>
date: Tue, 7 Feb 2006 05:27:15 -0800
author: Li Weng am
|
|