Posted on: 6/5/2013 11:25:29 PM | Views : 348

I have code that sends an email as below (SC is defined as an smtpclient).
The problem: If the addressee email is bad I get an ugly error screen, so I try to catch the exception, but the rest of the code runs and other stuff on the page happens so the user never sees the error message.
My question: How do I stop everything right after catching the exception? Right now the rest of the code runs (I know it has to be simple but I have a brain freeze going here :=(
Here's the code
msg = New MailMessage(Membership.GetUser.Email, TxtBxTo.Text, TxtBxSubject.Text, sb.ToString()) Try          sc.Send(msg) Catch ex As Exception           LblErrorMsg.Text = "Sorry, but it seems that user has an invalid email address listed. You will be unable to contact him"
         What code can I put ...

Go to the complete details ...