Sending Email from GridView
<p>i am trying to send all the email listed in my GridView but for somereason, the email does not get sent out.  I am suspecting my Send function (smtpClient.Send(mailMessage); is not working or i am missing something.  Pls help as i have spent so many hours on figuring out this.  thanks</p>

<pre><code>protected void chkAll_CheckedChanged(object sender, EventArgs e) 
{ 
    foreach(GridViewRow gr in GridView1.Rows) 
    { 
        CheckBox cb = (CheckBox)gr.FindControl("chkItem"); 
        if(((CheckBox)sender).Checked) 
            cb.Checked = true; 
        else 
             cb.Checked = false; 
    } 
} 

protected void Button3_Click(object sender, EventArgs e) 
{ 
    StringBuilder sb = new StringBuilder(); 

    foreach(GridViewRow gr in GridView1.Rows) 
    { 
        CheckBox cb = (CheckBox)gr.FindControl("chkItem"); 
        if(cb.Checked) 
        { 
            sb.Append(GridView1.DataKeys[gr.RowIndex]["Email"].ToString()); 
            sb.Append(","); 
        } 
    } 

    //Create instance of main mail message class. 
    System.Net.Mail.MailMessage mailMessage=new System.Net.Mail.MailMessage(); 

        mailMessage.From = new System.Net.Mail.MailAddress(
                   System.Configuration.ConfigurationManager
                                 .AppSettings["fromEmailAddress"]); 

        mailMessage.Priority = System.Net.Mail.MailPriority.High; 
        //Text/HTML 
        mailMessage.IsBodyHtml = false; 
        mailMessage.Body = "Hello, here is new email"; 
        mailMessage.Subject = "RCA APPROVAL IS REQUIRED"; 

        System.Net.Mail.SmtpClient smtpClient=new System.Net.Mail.SmtpClient();

        try 
        { 
            smtpClient.Send(mailMessage); 

            Response.Write("&lt;B&gt;Email Has been sent successfully.&lt;/B&gt;"); 
        } 
        catch (Exception ex) 
        { 
            Response.Write(ex.Message); 
        } 
    }
</code></pre>
