No validation functionality when using System.Net.Mail
<p>It seems that when I configure my email settings in the code behind for a contact page the validation controls no longer work. I have required field validation and regular expression validation to validate email addresses. Validation works on click event before I insert email configurations which requires me to use System.Net.Mail. Here is the code behind:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Contact : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
    MailMessage mail = new MailMessage();
    mail.To.Add("email@gmail.com");
    mail.From = new MailAddress(EmailAddressTextBox.Text);
    mail.Subject = SubjectTextBox.Text;

    mail.Body = "email address: " + EmailAddressTextBox.Text + "&lt;br /&gt;" + MessageTextBox.Text;

    mail.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address  
    smtp.Credentials = new System.Net.NetworkCredential
         ("email@gmail.com", "password");
    //Or your Smtp Email ID and Password  
    smtp.EnableSsl = true;
    smtp.Port = 587;
    smtp.Send(mail);

    EmailAddressTextBox.Text = String.Empty;
    SubjectTextBox.Text = String.Empty;
    MessageTextBox.Text = String.Empty;
}
}
</code></pre>
