Emailing Errors from Pages

B

Brian

I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
B

Brian

Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

Alvin Bruney said:
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
A

Alvin Bruney [MVP]

please make sure you have the cdo dll installed on the server. if it is, you
will need to re-register it at the command line using the regsvr32 utility

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

Alvin Bruney said:
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
E

Eric

Check the InnerException and InnerException's InnerException property. They
can be nested two or three deep. The innermost exception has the actual
error message that caused the problem.

Eric


Brian said:
Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top