469,271 Members | 1,063 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Sending Email via Exchange server and System.Web.Mail

Hello,

I am trying to create a class to send email via POP3 or Exchange.

Everything works fine when sending via POP3 but fails when sending via
exchange.
Error: Could not access 'CDO.Message' object.

The following code works fine in a VB.Net test app but fails on the web.
Does anyone have an idea why??

'--------------------------------------------------------------------
Dim mMail As New mail.MailMessage
Dim smtp as mail.SmtpMail

With mMail
.From = _addressFrom
.To = _sendTo
.Cc = _CC
.Subject = _subject
.Body = _body
.BodyFormat = _format
End With

' Check if the server type is POP3 or MS Exchange
If _mailServerType = ServerType.POP3 Then
smtp.SmtpServer = _smtpHost
Else
' The following code is need to authenticate to a exchange server
' Where the 2 specifies NTLM, 1 for basic, 0 for none (the default)
Dim userid As String = String.Format("{0}\{1}", _domain, _mailbox)

mMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthent
icate", 2)

mMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusernam
e", userid)

mMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpasswor
d", _password)

mMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver"
, _smtpHost)
End If

smtp.Send(mMail)
'--------------------------------------------------------------------

Thanks,
RedEye
Nov 18 '05 #1
2 3266
Hi,

The most common cause is security issue. The default ASP.NWT user
doesn’t have permissions to access CDO objects. You can check if its
security two ways:
1) Remove anonymous access and add Identity tag with impersonate
attribute to web.config.

2) Use Identity tag with user and password attribute set to user with
sufficient rights.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Thanks for the input but it didn't work.

1) I tried what you suggested - no go.
2) I gave power user rights to ASPNET user - no go.

I will keep trying other things.

Thanks again!!

"Natty Gur" <na***@dao2com.com> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
Hi,

The most common cause is security issue. The default ASP.NWT user
doesn't have permissions to access CDO objects. You can check if its
security two ways:
1) Remove anonymous access and add Identity tag with impersonate
attribute to web.config.

2) Use Identity tag with user and password attribute set to user with
sufficient rights.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Sven Templin | last post: by
17 posts views Thread by Bonj | last post: by
2 posts views Thread by Gaz | last post: by
2 posts views Thread by Jim in Arizona | last post: by
1 post views Thread by Gilbert Cheung | last post: by
8 posts views Thread by Mike Owen | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.