Re: How to find out what type of error it is: Failure sending mail.

Tech-Archive recommends: Fix windows errors by optimizing your registry



When you are in a Catch section, notice that the exception is passed to the catch as "ex". If you check out the properties of "ex", you can find out about the exception. Start with this:

Catch ex As Exception
console.writeline("Exception type is: " & ex.getType.toString)
console.writeline("Exception message is: " & ex.Message)


"JoeP" <NoSpam@xxxxxxxxxxx> wrote in message news:%23XxCPgpRIHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
Hi All,

Ok, after checking into it I had some code after the End Try and that was the reason Alert() did not pop up.
Moving that code under the Try fixed the problem.

But I am trying to break the message into 2 lines:

ClientScript.RegisterStartupScript(Me.GetType(), "E-Mail Problem", String.Format("Alert('There was a problem in sending the email! Please call us by phone {0}');", smtpEx.Message.Replace("'", "\'")), True)

Now how do I bring the actual err line into the second line of the Alert()

There was a problem in sending the email! Please call us by phone.
Unable to cast object of type 'System.Int32' to type 'System.Net.Mail.MailMessage'

Thanks,

Joe


"JoeP" <NoSpam@xxxxxxxxxxx> wrote in message news:eGeSbJpRIHA.5988@xxxxxxxxxxxxxxxxxxxxxxx
Well I had actuallt the code like the below: The debugger poped up and just said that the Failure sending mail.
and did not provide the reason. But from some reason in my computer under Visual Studio 2005, the Alert message did not pop up.
Just wondering why? (The debugger did).

Thanks,

Joe

Try
some code.....
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody

Dim oSMTP As New SmtpClient
oSMTP.Send(oMailMessage) (in this line I am getting the above err)

Catch smtpEx As SmtpException
ClientScript.RegisterStartupScript(Me.GetType(), "E-Mail Problem", String.Format("Alert('There was a problem in sending the email: {0}');", smtpEx.Message.Replace("'", "\'")), True)

Catch generalEx As Exception

ClientScript.RegisterStartupScript(Me.GetType(), "General Problem", String.Format("alert('There was a general problem: {0}');", generalEx.Message.Replace("'", "\'")), True)

End Try




"Scott M." <smar@xxxxxxxxxxxxx> wrote in message news:%23lIk0%23cRIHA.4444@xxxxxxxxxxxxxxxxxxxxxxx
Wrap the code in a try...catch block?


"JoeP" <NoSpam@xxxxxxxxxxx> wrote in message news:%23i4RTOcRIHA.3516@xxxxxxxxxxxxxxxxxxxxxxx
Hi All,

How can I find the reason for such an error: Failure sending mail.

Some Code...

oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient
oSMTP.Send(oMailMessage) (in this line I am getting the above err)

Appreciate any feedback

Thanks,

Joe



Relevant Pages

  • Re: Apple - Simply the best
    ... The situation you outline is precisely the reason that the Distance ... Selling Regulations came into place, and makes no difference to the ... makes an audible alert; it does. ... Does the calendar really have an audible alert? ...
    (uk.comp.sys.mac)
  • Re: The Problem with Misinformation
    ... information that satisfies the standard in all cases, ... You must alert your 2C response to 1H. ... Unless you know the reason you can not know that you have to alert. ... Somebody had to make the determination that the bid was an alert. ...
    (rec.games.bridge)
  • Re: NAT: Is this really a clear Mind?
    ... I'm Listening to Reason!" ... conscious, clear-minded and alert at the time of my death," Fleming ... have at my death. ... I do think government intervention can be ...
    (rec.audio.opinion)
  • Re: How to find out what type of error it is: Failure sending mail.
    ... after checking into it I had some code after the End Try and that was the reason Alert() did not pop up. ... Now how do I bring the actual err line into the second line of the Alert ... Well I had actuallt the code like the below: The debugger poped up and just said that the Failure sending mail. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Coding inside the debugger
    ... but why isn't the test written so that the reason it fails is ... If something fails in tests like these, ... public void testCreateWithDefaultthrows Exception { ... Ghostworld world = worldWithClass; ...
    (comp.object)