Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Mon, 13 Aug 2007 10:29:39 +1000,    group: microsoft.public.exchange2000.development        back       


Re: get e-mail from Exchange Server 2003   
> 1. WebDav101 article, states that Authentication type "NTLM", in obsolete.
> therefore i use "BASIC" Authentication .

Be careful this is only true in certain configurations. Eg if you have Forms 
Based Authentication enabled for OWA then you have to use Basic 
Authentication and SSL. If you aren't using FBA then you can use either NTLM 
or BASIC. You should never use Basic Authentication without SSL because your 
passwords will be transmitted as clear text. To say "NTLM", in obsolete is 
inaccurate (its actually the default authentication mechanism for EWS in 
Exchange 2007). If you don't have FBA enabled and your don't have any 
proxies in-between then I would use NTLM over BASIC as its a more secure 
mechanism (that said you should always use SSL where you can to make sure 
all your conversations are encrypted). The timeouts maybe because its trying 
to authentication via another mechanism

Cheers
Glen

"josephine"  wrote in message 
news:EDE378D3-66C3-4E8B-A0E1-2BB6AF029B5B@microsoft.com...
> few quick questions please.
>
> 1. WebDav101 article, states that Authentication type "NTLM", in obsolete.
> therefore i use "BASIC" Authentication .
> my app searches for all mails having subject "xxx".
> for each hRef returned,  ->
> "GET" request will save attachment.
>   "PROPPATCH" request mark as 'Read=True'.
>      lastly, "MOVE" request will move to folder in inbox
>
> when debuggin i notice "BASIC" tends to delay response, till 'TimeOut'
> exception pops.
> why like this?
> which authentication should i use?
>
> thanks in advance,
> kind regards,
> happy friday.
> -j.
date: Mon, 13 Aug 2007 10:29:39 +1000   author:   Glen Scales [MVP]

Re: get e-mail from Exchange Server 2003   
thanks for the 'allow re-name' ref!! helps me lots.

sorry, question re authentication..

i use a credential cash object;
        MyCredentialCache.Add(New System.Uri(strSrcURI), "NTLM", New 
System.Net.NetworkCredential(strUserName, strPassword, strDomain))

question re SSL
strSrcURI = "http://rmailsrv-dcm01.ds.rimaila.com/exchange/alias/Inbox/"
source hRef doesnt contain https; and when i try connect https, i.e., 
strSrcURI = "http://rmailsrv-dcm06.ds.rimaila.com/exchange/alias/Inbox/"
error pops: server cant be found.
but im sure Exchange is SSL enabled..

 how do i make sure i always use SSL please??

thanks in advance,
-j.




"Glen Scales [MVP]" wrote:

> > 1. WebDav101 article, states that Authentication type "NTLM", in obsolete.
> > therefore i use "BASIC" Authentication .
> 
> Be careful this is only true in certain configurations. Eg if you have Forms 
> Based Authentication enabled for OWA then you have to use Basic 
> Authentication and SSL. If you aren't using FBA then you can use either NTLM 
> or BASIC. You should never use Basic Authentication without SSL because your 
> passwords will be transmitted as clear text. To say "NTLM", in obsolete is 
> inaccurate (its actually the default authentication mechanism for EWS in 
> Exchange 2007). If you don't have FBA enabled and your don't have any 
> proxies in-between then I would use NTLM over BASIC as its a more secure 
> mechanism (that said you should always use SSL where you can to make sure 
> all your conversations are encrypted). The timeouts maybe because its trying 
> to authentication via another mechanism
> 
> Cheers
> Glen
> 
> "josephine"  wrote in message 
> news:EDE378D3-66C3-4E8B-A0E1-2BB6AF029B5B@microsoft.com...
> > few quick questions please.
> >
> > 1. WebDav101 article, states that Authentication type "NTLM", in obsolete.
> > therefore i use "BASIC" Authentication .
> > my app searches for all mails having subject "xxx".
> > for each hRef returned,  ->
> > "GET" request will save attachment.
> >   "PROPPATCH" request mark as 'Read=True'.
> >      lastly, "MOVE" request will move to folder in inbox
> >
> > when debuggin i notice "BASIC" tends to delay response, till 'TimeOut'
> > exception pops.
> > why like this?
> > which authentication should i use?
> >
> > thanks in advance,
> > kind regards,
> > happy friday.
> > -j. 
> 
> 
>
date: Sun, 12 Aug 2007 22:56:01 -0700   author:   josephine

Re: "Allow-Rename" , "T"   
hey. 
got a little issue with allow rename header.
i must be doing something wrong!!!
as the whole of destination folder, with e-mails in it, seem to just 
disappear in thin mailbox. not even to the recycle-bin.. just gone!
code;
            Request = CType(System.Net.WebRequest.Create(hRef(i)), 
System.Net.HttpWebRequest)
            Request.Credentials = MyCredentialCache   
            Request.Headers.Add("Translate", "f") ' Set the Translate header.
            strDestURI = 
"http://msrv-cd06.ds.rml.com/exchange/alias/Inbox/test/"
            Request.Headers.Add("Destination", strDestURI)
            Request.Headers.Add("Overwrite", "F")
            Request.Headers.Add("Allow-rename", "t")
            Request.Method = "MOVE"
            rResponse = CType(Request.GetResponse(), 
System.Net.HttpWebResponse)
            flMoved = True

e.g., post this code (that runs fine), a folder named 'test' inside the 
inbox, disappears completely, inc mails in it..

wouls very much appreciate your take on this.

thanks in advance,

kind regards,
-j.
date: Mon, 13 Aug 2007 05:02:02 -0700   author:   josephine

Re: get e-mail from Exchange Server 2003   
Your URI needs to start with https:// you should be able to tell if your 
using SSL by looking at any of your OWA requests (eg do you see the padlock 
in OWA) or just by looking at the IIS properties of the default website and 
seeing if there is a SSL certificate installed or if the server is set to 
listen on port 443.

cheers
Glen



"josephine"  wrote in message 
news:F40DAD98-3CB4-45AA-AA86-5A3939640C8D@microsoft.com...
> thanks for the 'allow re-name' ref!! helps me lots.
>
> sorry, question re authentication..
>
> i use a credential cash object;
>        MyCredentialCache.Add(New System.Uri(strSrcURI), "NTLM", New
> System.Net.NetworkCredential(strUserName, strPassword, strDomain))
>
> question re SSL
> strSrcURI = "http://rmailsrv-dcm01.ds.rimaila.com/exchange/alias/Inbox/"
> source hRef doesnt contain https; and when i try connect https, i.e.,
> strSrcURI = "http://rmailsrv-dcm06.ds.rimaila.com/exchange/alias/Inbox/"
> error pops: server cant be found.
> but im sure Exchange is SSL enabled..
>
> how do i make sure i always use SSL please??
>
> thanks in advance,
> -j.
>
>
>
>
> "Glen Scales [MVP]" wrote:
>
>> > 1. WebDav101 article, states that Authentication type "NTLM", in 
>> > obsolete.
>> > therefore i use "BASIC" Authentication .
>>
>> Be careful this is only true in certain configurations. Eg if you have 
>> Forms
>> Based Authentication enabled for OWA then you have to use Basic
>> Authentication and SSL. If you aren't using FBA then you can use either 
>> NTLM
>> or BASIC. You should never use Basic Authentication without SSL because 
>> your
>> passwords will be transmitted as clear text. To say "NTLM", in obsolete 
>> is
>> inaccurate (its actually the default authentication mechanism for EWS in
>> Exchange 2007). If you don't have FBA enabled and your don't have any
>> proxies in-between then I would use NTLM over BASIC as its a more secure
>> mechanism (that said you should always use SSL where you can to make sure
>> all your conversations are encrypted). The timeouts maybe because its 
>> trying
>> to authentication via another mechanism
>>
>> Cheers
>> Glen
>>
>> "josephine"  wrote in message
>> news:EDE378D3-66C3-4E8B-A0E1-2BB6AF029B5B@microsoft.com...
>> > few quick questions please.
>> >
>> > 1. WebDav101 article, states that Authentication type "NTLM", in 
>> > obsolete.
>> > therefore i use "BASIC" Authentication .
>> > my app searches for all mails having subject "xxx".
>> > for each hRef returned,  ->
>> > "GET" request will save attachment.
>> >   "PROPPATCH" request mark as 'Read=True'.
>> >      lastly, "MOVE" request will move to folder in inbox
>> >
>> > when debuggin i notice "BASIC" tends to delay response, till 'TimeOut'
>> > exception pops.
>> > why like this?
>> > which authentication should i use?
>> >
>> > thanks in advance,
>> > kind regards,
>> > happy friday.
>> > -j.
>>
>>
>>
date: Tue, 14 Aug 2007 12:58:26 +1000   author:   Glen Scales [MVP]

Re: "Allow-Rename" , "T"   
You still need to assign the item a URI eg 
http://msrv-cd06.ds.rml.com/exchange/alias/Inbox/test/test.eml using that 
header will mean if there is already a item in the folder with that URI it 
will rename the item something else instead of the request just failing. You 
current request is trying to overwrite the folder URI which is why its 
getting all messed up.

Cheers
Glen



"josephine"  wrote in message 
news:62707521-7356-42CA-B2AE-F4855A3A22A5@microsoft.com...
> hey.
> got a little issue with allow rename header.
> i must be doing something wrong!!!
> as the whole of destination folder, with e-mails in it, seem to just
> disappear in thin mailbox. not even to the recycle-bin.. just gone!
> code;
>            Request = CType(System.Net.WebRequest.Create(hRef(i)),
> System.Net.HttpWebRequest)
>            Request.Credentials = MyCredentialCache
>            Request.Headers.Add("Translate", "f") ' Set the Translate 
> header.
>            strDestURI =
> "http://msrv-cd06.ds.rml.com/exchange/alias/Inbox/test/"
>            Request.Headers.Add("Destination", strDestURI)
>            Request.Headers.Add("Overwrite", "F")
>            Request.Headers.Add("Allow-rename", "t")
>            Request.Method = "MOVE"
>            rResponse = CType(Request.GetResponse(),
> System.Net.HttpWebResponse)
>            flMoved = True
>
> e.g., post this code (that runs fine), a folder named 'test' inside the
> inbox, disappears completely, inc mails in it..
>
> wouls very much appreciate your take on this.
>
> thanks in advance,
>
> kind regards,
> -j.
date: Tue, 14 Aug 2007 13:08:22 +1000   author:   Glen Scales [MVP]

Re: get e-mail from Exchange Server 2003   
howzit Glen,

re. "Allow-Rename"... -> thanks for your post. works fab. appreciate it!

re. HTTPS, URI doesnt start with https://, when i try, cant find server 
error pops.
nevertheless, network ppl here, assure me server is SSL enabled..
should mention, app runs from within the domain in which exchange server is 
a member of.. could dat be an issue??

anyhow..
thanks so much for your help.
nice week.
-j.
 
"Glen Scales [MVP]" wrote:

> Your URI needs to start with https:// you should be able to tell if your 
> using SSL by looking at any of your OWA requests (eg do you see the padlock 
> in OWA) or just by looking at the IIS properties of the default website and 
> seeing if there is a SSL certificate installed or if the server is set to 
> listen on port 443.
> 
> cheers
> Glen
> 
> 
> 
> "josephine"  wrote in message 
> news:F40DAD98-3CB4-45AA-AA86-5A3939640C8D@microsoft.com...
> > thanks for the 'allow re-name' ref!! helps me lots.
> >
> > sorry, question re authentication..
> >
> > i use a credential cash object;
> >        MyCredentialCache.Add(New System.Uri(strSrcURI), "NTLM", New
> > System.Net.NetworkCredential(strUserName, strPassword, strDomain))
> >
> > question re SSL
> > strSrcURI = "http://rmailsrv-dcm01.ds.rimaila.com/exchange/alias/Inbox/"
> > source hRef doesnt contain https; and when i try connect https, i.e.,
> > strSrcURI = "http://rmailsrv-dcm06.ds.rimaila.com/exchange/alias/Inbox/"
> > error pops: server cant be found.
> > but im sure Exchange is SSL enabled..
> >
> > how do i make sure i always use SSL please??
> >
> > thanks in advance,
> > -j.
> >
> >
> >
> >
> > "Glen Scales [MVP]" wrote:
> >
> >> > 1. WebDav101 article, states that Authentication type "NTLM", in 
> >> > obsolete.
> >> > therefore i use "BASIC" Authentication .
> >>
> >> Be careful this is only true in certain configurations. Eg if you have 
> >> Forms
> >> Based Authentication enabled for OWA then you have to use Basic
> >> Authentication and SSL. If you aren't using FBA then you can use either 
> >> NTLM
> >> or BASIC. You should never use Basic Authentication without SSL because 
> >> your
> >> passwords will be transmitted as clear text. To say "NTLM", in obsolete 
> >> is
> >> inaccurate (its actually the default authentication mechanism for EWS in
> >> Exchange 2007). If you don't have FBA enabled and your don't have any
> >> proxies in-between then I would use NTLM over BASIC as its a more secure
> >> mechanism (that said you should always use SSL where you can to make sure
> >> all your conversations are encrypted). The timeouts maybe because its 
> >> trying
> >> to authentication via another mechanism
> >>
> >> Cheers
> >> Glen
> >>
> >> "josephine"  wrote in message
> >> news:EDE378D3-66C3-4E8B-A0E1-2BB6AF029B5B@microsoft.com...
> >> > few quick questions please.
> >> >
> >> > 1. WebDav101 article, states that Authentication type "NTLM", in 
> >> > obsolete.
> >> > therefore i use "BASIC" Authentication .
> >> > my app searches for all mails having subject "xxx".
> >> > for each hRef returned,  ->
> >> > "GET" request will save attachment.
> >> >   "PROPPATCH" request mark as 'Read=True'.
> >> >      lastly, "MOVE" request will move to folder in inbox
> >> >
> >> > when debuggin i notice "BASIC" tends to delay response, till 'TimeOut'
> >> > exception pops.
> >> > why like this?
> >> > which authentication should i use?
> >> >
> >> > thanks in advance,
> >> > kind regards,
> >> > happy friday.
> >> > -j.
> >>
> >>
> >> 
> 
> 
>
date: Tue, 14 Aug 2007 06:16:03 -0700   author:   josephine

Re: get e-mail from Exchange Server 2003   
> re. HTTPS, URI doesnt start with https://, when i try, cant find server
> error pops.
> nevertheless, network ppl here, assure me server is SSL enabled..

This is doesn't make sense to me every IIS server is SSL enabled but whether 
you have installed a SSL certificate and set the server to listen on port is 
a different issue. I would suggest you have a read of 
http://www.petri.co.il/configure_ssl_on_owa.htm there are some further links 
down the bottom of that page that link to further information. From a 
developers perspective its either there or it isn't the only thing you 
should have to worry about is whether you need to implement extra code to 
deal with Self Signed Certificates.


> should mention, app runs from within the domain in which exchange server 
> is
> a member of.. could dat be an issue??

No this wont make any difference.

Cheers
Glen



"josephine"  wrote in message 
news:07D79F5C-A9F3-4939-B0F5-D616974F40D4@microsoft.com...
> howzit Glen,
>
> re. "Allow-Rename"... -> thanks for your post. works fab. appreciate it!
>
> re. HTTPS, URI doesnt start with https://, when i try, cant find server
> error pops.
> nevertheless, network ppl here, assure me server is SSL enabled..
> should mention, app runs from within the domain in which exchange server 
> is
> a member of.. could dat be an issue??
>
> anyhow..
> thanks so much for your help.
> nice week.
> -j.
>
> "Glen Scales [MVP]" wrote:
>
>> Your URI needs to start with https:// you should be able to tell if your
>> using SSL by looking at any of your OWA requests (eg do you see the 
>> padlock
>> in OWA) or just by looking at the IIS properties of the default website 
>> and
>> seeing if there is a SSL certificate installed or if the server is set to
>> listen on port 443.
>>
>> cheers
>> Glen
>>
>>
>>
>> "josephine"  wrote in message
>> news:F40DAD98-3CB4-45AA-AA86-5A3939640C8D@microsoft.com...
>> > thanks for the 'allow re-name' ref!! helps me lots.
>> >
>> > sorry, question re authentication..
>> >
>> > i use a credential cash object;
>> >        MyCredentialCache.Add(New System.Uri(strSrcURI), "NTLM", New
>> > System.Net.NetworkCredential(strUserName, strPassword, strDomain))
>> >
>> > question re SSL
>> > strSrcURI = 
>> > "http://rmailsrv-dcm01.ds.rimaila.com/exchange/alias/Inbox/"
>> > source hRef doesnt contain https; and when i try connect https, i.e.,
>> > strSrcURI = 
>> > "http://rmailsrv-dcm06.ds.rimaila.com/exchange/alias/Inbox/"
>> > error pops: server cant be found.
>> > but im sure Exchange is SSL enabled..
>> >
>> > how do i make sure i always use SSL please??
>> >
>> > thanks in advance,
>> > -j.
>> >
>> >
>> >
>> >
>> > "Glen Scales [MVP]" wrote:
>> >
>> >> > 1. WebDav101 article, states that Authentication type "NTLM", in
>> >> > obsolete.
>> >> > therefore i use "BASIC" Authentication .
>> >>
>> >> Be careful this is only true in certain configurations. Eg if you have
>> >> Forms
>> >> Based Authentication enabled for OWA then you have to use Basic
>> >> Authentication and SSL. If you aren't using FBA then you can use 
>> >> either
>> >> NTLM
>> >> or BASIC. You should never use Basic Authentication without SSL 
>> >> because
>> >> your
>> >> passwords will be transmitted as clear text. To say "NTLM", in 
>> >> obsolete
>> >> is
>> >> inaccurate (its actually the default authentication mechanism for EWS 
>> >> in
>> >> Exchange 2007). If you don't have FBA enabled and your don't have any
>> >> proxies in-between then I would use NTLM over BASIC as its a more 
>> >> secure
>> >> mechanism (that said you should always use SSL where you can to make 
>> >> sure
>> >> all your conversations are encrypted). The timeouts maybe because its
>> >> trying
>> >> to authentication via another mechanism
>> >>
>> >> Cheers
>> >> Glen
>> >>
>> >> "josephine"  wrote in message
>> >> news:EDE378D3-66C3-4E8B-A0E1-2BB6AF029B5B@microsoft.com...
>> >> > few quick questions please.
>> >> >
>> >> > 1. WebDav101 article, states that Authentication type "NTLM", in
>> >> > obsolete.
>> >> > therefore i use "BASIC" Authentication .
>> >> > my app searches for all mails having subject "xxx".
>> >> > for each hRef returned,  ->
>> >> > "GET" request will save attachment.
>> >> >   "PROPPATCH" request mark as 'Read=True'.
>> >> >      lastly, "MOVE" request will move to folder in inbox
>> >> >
>> >> > when debuggin i notice "BASIC" tends to delay response, till 
>> >> > 'TimeOut'
>> >> > exception pops.
>> >> > why like this?
>> >> > which authentication should i use?
>> >> >
>> >> > thanks in advance,
>> >> > kind regards,
>> >> > happy friday.
>> >> > -j.
>> >>
>> >>
>> >>
>>
>>
>>
date: Wed, 15 Aug 2007 12:47:34 +1000   author:   Glen Scales [MVP]

Re: Retrieve attachment from Exchange Server 2003   
howzit Glen, hope you're well,

got the folowing code to send mail. works fab, (gracias)
trying to add attachment to the message, no luck...
pls can you have a look.
many thanks,
J.

        Dim PUTRequest As System.Net.HttpWebRequest
        Dim PUTResponse As System.Net.HttpWebResponse
        Dim MOVERequest As System.Net.HttpWebRequest
        Dim MOVEResponse As System.Net.HttpWebResponse
        Dim MyCredentialCache As System.Net.CredentialCache
        Dim strMailboxURI As String
        Dim strSubURI As String
        Dim strTempURI As String
        Dim strServer As String
        Dim strPassword As String
        Dim strDomain As String
        Dim strAlias As String
        Dim strTo As String
        Dim strSubject As String
        Dim strText As String
        Dim strBody As String
        Dim PUTRequestStream As System.IO.Stream
        Dim bytes() As Byte
        Try
            strServer = "MYSERVER.COM"
            strPassword = "PassWord"
            strDomain = "DOMAIN"
            strAlias = "ALIAS"
            strTo = "RECIPIENT1;RECIPIENT2"
            strSubject = "JarrowDB Daily Data Transfer Report. (Remote = 
VERIZON to SRVSQL01) "
            strText = "Good Morning"
            strMailboxURI = "http://" & strServer & "/exchange/" & strAlias 
' Build the mailbox URI.
            strSubURI = "http://" & strServer & "/exchange/" & strAlias _
               & "/##DavMailSubmissionURI##/"
            strTempURI = "http://" & strServer & "/exchange/" & strAlias & _
               "/drafts/" & strSubject & ".eml"
            strBody = "To: " & strTo & vbNewLine & _
               "Subject: " & strSubject & vbNewLine & _
               "Date: " & System.DateTime.Now & _
               "X-Mailer: test mailer" & vbNewLine & _
               "MIME-Version: 1.0" & vbNewLine & _
               "Content-Type: text/plain;" & vbNewLine & _
               "Charset = ""iso-8859-1""" & vbNewLine & _
               "Content-Transfer-Encoding: 7bit" & vbNewLine & _
               vbNewLine & strText
            MyCredentialCache = New System.Net.CredentialCache '==>>TODO: 
check basic credential authenticaton!!
            MyCredentialCache.Add(New System.Uri(strMailboxURI), "NTLM", New 
System.Net.NetworkCredential(strAlias, strPassword, strDomain))
            PUTRequest = CType(System.Net.WebRequest.Create(strTempURI), 
System.Net.HttpWebRequest)
            PUTRequest.Credentials = MyCredentialCache ' Add the network 
credentials to the request.
            PUTRequest.Method = "PUT"    ' Specify the PUT method.
            bytes = System.Text.Encoding.UTF8.GetBytes(strBody)  ' Encode 
the body using UTF-8.
            PUTRequest.ContentLength = bytes.Length
            PUTRequestStream = PUTRequest.GetRequestStream()   ' Get a 
reference to the request stream.
            PUTRequestStream.Write(bytes, 0, bytes.Length) ' Write the 
message body to the request stream.
            PUTRequestStream.Close()
            PUTRequest.ContentType = "message/rfc822"
            PUTResponse = CType(PUTRequest.GetResponse(), 
System.Net.HttpWebResponse)
            MOVERequest = CType(System.Net.WebRequest.Create(strTempURI), 
System.Net.HttpWebRequest)
            MOVERequest.Credentials = MyCredentialCache
            MOVERequest.Method = "MOVE"
            MOVERequest.Headers.Add("Destination", strSubURI)
            MOVEResponse = CType(MOVERequest.GetResponse(), 
System.Net.HttpWebResponse)
            PUTResponse.Close()
            MOVEResponse.Close()
        Catch ex As Exception
        End Try
date: Thu, 20 Sep 2007 08:00:00 -0700   author:   josephine

Re: Retrieve attachment from Exchange Server 2003   
The way i do this is to add a referance to the old CDOSYS library and then 
create the message using CDOSYS grab the stream of the message via ADO and 
then post the stream via WebDAV eg

strSubject = "JarrowDB Daily Data Transfer Report."
strText = "Good Morning"
strMailboxURI = "http://" & strServer & "/exchange/" & strAlias            ' 
Build the mailbox URI.
strSubURI = "http://" & strServer & "/exchange/" & strAlias _
& "/##DavMailSubmissionURI##/"
strTempURI = "http://" & strServer & "/exchange/" & strAlias & _
"/drafts/" & strSubject & ".eml"
Dim msg As New CDO.Message
msg.To = strTo
msg.Subject = strSubject
msg.AddAttachment("c:\\attachment.doc")
Dim stm As ADODB.Stream
stm = msg.GetStream()

strBody = stm.ReadText(-1)
MyCredentialCache = New System.Net.CredentialCache '==>>TODO: heck basic 
credential authenticaton!!
MyCredentialCache.Add(New System.Uri(strMailboxURI), "NTLM", New 
System.Net.NetworkCredential(strAlias, strPassword, strDomain))
PUTRequest = CType(System.Net.WebRequest.Create(strTempURI), 
System.Net.HttpWebRequest)
PUTRequest.Credentials = MyCredentialCache ' Add the network credentials to 
the request.
PUTRequest.Method = "PUT"    ' Specify the PUT method.
bytes = System.Text.Encoding.UTF8.GetBytes(strBody)  ' Encode the body using 
UTF-8.
PUTRequest.ContentLength = bytes.Length
PUTRequestStream = PUTRequest.GetRequestStream()   ' Get a reference to the 
request stream.
PUTRequestStream.Write(bytes, 0, bytes.Length) ' Write the message body to 
the request stream.
PUTRequestStream.Close()
PUTRequest.ContentType = "message/rfc822"
PUTResponse = CType(PUTRequest.GetResponse(), System.Net.HttpWebResponse)
MOVERequest = CType(System.Net.WebRequest.Create(strTempURI), 
System.Net.HttpWebRequest)
MOVERequest.Credentials = MyCredentialCache
MOVERequest.Method = "MOVE"
MOVERequest.Headers.Add("Destination", strSubURI)
MOVEResponse = CType(MOVERequest.GetResponse(), System.Net.HttpWebResponse)
PUTResponse.Close()
MOVEResponse.Close()

Cheers
Glen
"josephine"  wrote in message 
news:22B72726-88F6-4E7D-B960-45D5B1253F4C@microsoft.com...
> howzit Glen, hope you're well,
>
> got the folowing code to send mail. works fab, (gracias)
> trying to add attachment to the message, no luck...
> pls can you have a look.
> many thanks,
> J.
>
>        Dim PUTRequest As System.Net.HttpWebRequest
>        Dim PUTResponse As System.Net.HttpWebResponse
>        Dim MOVERequest As System.Net.HttpWebRequest
>        Dim MOVEResponse As System.Net.HttpWebResponse
>        Dim MyCredentialCache As System.Net.CredentialCache
>        Dim strMailboxURI As String
>        Dim strSubURI As String
>        Dim strTempURI As String
>        Dim strServer As String
>        Dim strPassword As String
>        Dim strDomain As String
>        Dim strAlias As String
>        Dim strTo As String
>        Dim strSubject As String
>        Dim strText As String
>        Dim strBody As String
>        Dim PUTRequestStream As System.IO.Stream
>        Dim bytes() As Byte
>        Try
>            strServer = "MYSERVER.COM"
>            strPassword = "PassWord"
>            strDomain = "DOMAIN"
>            strAlias = "ALIAS"
>            strTo = "RECIPIENT1;RECIPIENT2"
>            strSubject = "JarrowDB Daily Data Transfer Report. (Remote =
> VERIZON to SRVSQL01) "
>            strText = "Good Morning"
>            strMailboxURI = "http://" & strServer & "/exchange/" & strAlias
> ' Build the mailbox URI.
>            strSubURI = "http://" & strServer & "/exchange/" & strAlias _
>               & "/##DavMailSubmissionURI##/"
>            strTempURI = "http://" & strServer & "/exchange/" & strAlias & 
> _
>               "/drafts/" & strSubject & ".eml"
>            strBody = "To: " & strTo & vbNewLine & _
>               "Subject: " & strSubject & vbNewLine & _
>               "Date: " & System.DateTime.Now & _
>               "X-Mailer: test mailer" & vbNewLine & _
>               "MIME-Version: 1.0" & vbNewLine & _
>               "Content-Type: text/plain;" & vbNewLine & _
>               "Charset = ""iso-8859-1""" & vbNewLine & _
>               "Content-Transfer-Encoding: 7bit" & vbNewLine & _
>               vbNewLine & strText
>            MyCredentialCache = New System.Net.CredentialCache '==>>TODO:
> check basic credential authenticaton!!
>            MyCredentialCache.Add(New System.Uri(strMailboxURI), "NTLM", 
> New
> System.Net.NetworkCredential(strAlias, strPassword, strDomain))
>            PUTRequest = CType(System.Net.WebRequest.Create(strTempURI),
> System.Net.HttpWebRequest)
>            PUTRequest.Credentials = MyCredentialCache ' Add the network
> credentials to the request.
>            PUTRequest.Method = "PUT"    ' Specify the PUT method.
>            bytes = System.Text.Encoding.UTF8.GetBytes(strBody)  ' Encode
> the body using UTF-8.
>            PUTRequest.ContentLength = bytes.Length
>            PUTRequestStream = PUTRequest.GetRequestStream()   ' Get a
> reference to the request stream.
>            PUTRequestStream.Write(bytes, 0, bytes.Length) ' Write the
> message body to the request stream.
>            PUTRequestStream.Close()
>            PUTRequest.ContentType = "message/rfc822"
>            PUTResponse = CType(PUTRequest.GetResponse(),
> System.Net.HttpWebResponse)
>            MOVERequest = CType(System.Net.WebRequest.Create(strTempURI),
> System.Net.HttpWebRequest)
>            MOVERequest.Credentials = MyCredentialCache
>            MOVERequest.Method = "MOVE"
>            MOVERequest.Headers.Add("Destination", strSubURI)
>            MOVEResponse = CType(MOVERequest.GetResponse(),
> System.Net.HttpWebResponse)
>            PUTResponse.Close()
>            MOVEResponse.Close()
>        Catch ex As Exception
>        End Try
>
>
date: Fri, 21 Sep 2007 12:20:27 +1000   author:   Glen Scales [MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us