Author: Dman100 | Posted on: 2/15/2009 10:22:04 PM | Views : 303

I have a two part question.  I am trying to learn how to handle errors when sending email using asp.net.

I've created a simple web form for testing different errors that can occur when sending an email.  I am testing this by sending thru my ISP from my localhost.

My first question is how do I write the errors to the event log?

Second, what is the best way to throw errors for testing?

I tried using Throw(), but that does not seem to work.

As an example, I want to test how the exception would be handled when a recipients emailbox was unavailable due to an incorrect email address or say the emailbox was busy due to maintanence or some other type of problem.  How would you use throw to test that type of scenario?


Thanks for any help.


I tried the following:

 protected void btnSend_Click(object sender, EventArgs e)
    {
        Se ...

Go to the complete details ...