472,334 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

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 3405
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_...
3
by: martin smith | last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to our SMTP server. We use a product called MailFilter to check for SPAM. It...
17
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be...
2
by: Gaz | last post by:
Hi all I am currently trying to send and email via exchange except I'm having a nightmare getting it working, you'd think this would be pertty...
2
by: Jim in Arizona | last post by:
I've made an application that is a computer problems (tickets) system. The employee goes to a web page and posts the comptuer problem they're...
8
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the...
9
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does...
1
by: Gilbert Cheung | last post by:
Hello. I am writing a website for my company. There is a sign-up form that requires us to send a confirmation email to our customer. Our company...
8
by: Mike Owen | last post by:
Hi, I am using the following code to send email on a Windows 2003 Web Server: Imports System.Net.Mail ........ Dim msgmail As New MailMessage...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.