G
Guest
Hello -
I am attempting to email error messages to myself in the event of an error.
I am using the following code:
Dim mail as New MailMessage()
Dim ErrorMessage = "The error description is as follows: " &
Server.GetLastError.ToString
mail.To = "(e-mail address removed)"
mail.From = "(e-mail address removed)"
mail.Subject = "Error in the Site"
mail.Priority = MailPriority.High
mail.BodyFormat = MailFormat.Text
mail.Body = ErrorMessage
mail.Body = "Testing Email from App"
SmtpMail.Send(mail)
I originally put it in the global.asax under Sub Application_Error(ByVal,
etc.) and included at the top:
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.Mail
I received nothing . . . nada . . . no email, no error message, nothing. I
then attempted to just email myself from a plain old aspx page, putting the
code in the click event of a button and taking out the error message
referrals. I still receive nothing. On debugging, it is showing that
everything is fine.
Next I tried sending to someone else on another pc, using their address in
the "To" portion. Again . . . nothing. I'm running Outlook and have no
problems emailing myself or the other PC from there.
I am using Visual Studio in an XP operating system. Is there some setting
somewhere I should check? Is there something drastically wrong with my code
above?
Any help you can give me will be greatly appreciated! This is starting to
drive me crazy . . .
I am attempting to email error messages to myself in the event of an error.
I am using the following code:
Dim mail as New MailMessage()
Dim ErrorMessage = "The error description is as follows: " &
Server.GetLastError.ToString
mail.To = "(e-mail address removed)"
mail.From = "(e-mail address removed)"
mail.Subject = "Error in the Site"
mail.Priority = MailPriority.High
mail.BodyFormat = MailFormat.Text
mail.Body = ErrorMessage
mail.Body = "Testing Email from App"
SmtpMail.Send(mail)
I originally put it in the global.asax under Sub Application_Error(ByVal,
etc.) and included at the top:
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.Mail
I received nothing . . . nada . . . no email, no error message, nothing. I
then attempted to just email myself from a plain old aspx page, putting the
code in the click event of a button and taking out the error message
referrals. I still receive nothing. On debugging, it is showing that
everything is fine.
Next I tried sending to someone else on another pc, using their address in
the "To" portion. Again . . . nothing. I'm running Outlook and have no
problems emailing myself or the other PC from there.
I am using Visual Studio in an XP operating system. Is there some setting
somewhere I should check? Is there something drastically wrong with my code
above?
Any help you can give me will be greatly appreciated! This is starting to
drive me crazy . . .