Could not access 'CDO.Message' object

R

Robert

I am trying to send an email message from the code behind
page of an aspx page.

Here is what I have:

=======================================
Imports System.Web.Mail

Private Sub EmailStuff()

Dim oMsg As MailMessage = New MailMessage
TRY
oMsg.From = "(e-mail address removed)"
oMsg.To = "(e-mail address removed)"
oMsg.Subject = "My Subject"
oMsg.Body = "This is the body of the email message"
SmtpMail.SmtpServer = "mySMTPServer"
SmtpMail.Send(oMsg) ' ERROR OCCURRS ON THIS LINE
CATCH Exc As Exception
msgbox Exc.Message
END TRY

End Sub
=======================================
Exc.Message returns this error message:
"Could not access 'CDO.Message' object"

This is from Visual Studio .NET 2003 running on Windows
XP PRO. Is this a permissions issue? Is there something
I need to setup as far as SMTP on this machine. The SMTP
service is running.
 
J

John Saunders

Robert said:
I am trying to send an email message from the code behind
page of an aspx page.
.....

=======================================
Exc.Message returns this error message:
"Could not access 'CDO.Message' object"

What does the rest of the message say? I've seen these recently whan one of
our mail servers decided to stop relaying for us. The "Could not access
'CDO.Message' object" exception gave me the full details of the error
message from the mail server.
 
R

Robert

As far as I can tell that was the full extent of the
error message. Is there a way for me to get more details
when the exception is thrown?
 
J

John Saunders

Robert said:
As far as I can tell that was the full extent of the
error message. Is there a way for me to get more details
when the exception is thrown?

You should be able to display the entire exception by using the ToString
method of the exception:

try
{
// something
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
}
 
R

Rimu Atkinson

often, this can be resolved by setting the correct permissions.

make sure the ASPNET user has permissions in the SMTP server to be able to
send mail. check out the security tab of the SMTP server's properties.

i have also found that editing machine.config can help, by loosening the
security of ASP.Net so that it runs as the most privileged account on the
system, thereby making permissions irrellivent. change the username
attribute of the processmodel thingy to SYSTEM. e.g. in my machine.config it
looks like this

<processModel enable="true" timeout="Infinite"
idleTimeout="Infinite" shutdownTimeout="0:00:05" requestLimit="Infinite"
requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60"
webGarden="false" cpuMask="0xffffffff" userName="SYSTEM"
password="AutoGenerate" logLevel="Errors" clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
responseRestartDeadlockInterval="00:09:00"
responseDeadlockInterval="00:03:00" maxWorkerThreads="25"
maxIoThreads="25"/>

note that is 1.0, and 1.1 may be different??? so don't just copy that text
verbatum.

when deploying your web app on it's final server, the admin person should
have set the permissions all correctly and you won't have to worry about
CDO.Message not being accessable. you wouldn't really want to make those
changes to a computer which was 'in the wild', but for development it
doesn't really matter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top