Sending Multiple Email From GridView
<p>I hope some can help me on this issue.  The purpose of this email functionality is to send an email to individuals whose emails are listed in the GridView  with attached specific URL string in the email body.  I was able to send a multiple emails from the GridView and also pass the current query string in the URL in the Email body.  So everything is working fine up to here.  I have one challenge that could not resolve.   I want to include also  in the URL  the corresponding ID of email in the GridView.  Here is how my current URL look like:
//MyHost/BCA/Users/QMR.aspx?Post_ID=303</p>

<p>if my gridview look like this:</p>

<pre><code>ID        Name              Email                       Post_ID
-------------------------------------------------------------------
32        Mike              xx@hot.com                  303
</code></pre>

<p>Then  I want to include the corresponding ID for this email in my URL like below and be able to send the URL to that user:
//MyHost/BCA/Users/QMR.aspx?Post_ID=303&amp;ID=32</p>

<p>thanks</p>

<p>Here is my code:</p>

<pre><code>protected void btnSendEmail_Click(object sender, EventArgs e)
 {
     MailMessage mailMessage = new MailMessage();
     foreach (GridViewRow gr in GridView1.Rows)
     {
         CheckBox cb = (CheckBox)gr.FindControl("chkItem");
         if (cb.Checked)
         {

             mailMessage.To.Add(new MailAddress(GridView1.DataKeys[gr.RowIndex]["Assigned_To"].ToString()));
             mailMessage.From = new System.Net.Mail.MailAddress(System.Configuration.ConfigurationManager.AppSettings["fromEmailAddress"]);
             mailMessage.Priority = System.Net.Mail.MailPriority.High;
             //Text/HTML
             mailMessage.IsBodyHtml = false;
             string mySubURI= HttpContext.Current.Request.Url.AbsoluteUri.ToString().Replace("Test.aspx", "QMR.aspx");       
             mailMessage.Body = "Hello, Please see this link" + mySubURI;
             mailMessage.Subject = "My Email Test";

             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>
