title: how to send datagridview contents to email by c#
body: <p>This is my code to send datagridview contents to email It works, but the names of the columns is not up to E-mail;
  What is your advice??</p>
  
  <pre><code>var client = new SmtpClient("smtp.gmail.com", 587);
          client.EnableSsl = true;
          client.Credentials = new NetworkCredential("email@gmail.com", "********");
  
          var mail = new MailMessage();
          mail.From = new MailAddress("email@gmail.com");
          mail.To.Add("email@gmail.com");
          mail.IsBodyHtml = true;
          mail.Subject = "any";
  
          string mailBody = "&lt;table width='100%' style='border:Solid 1px Black;'&gt;"; ;
  
          foreach (DataGridViewRow row in itemDataGridView.Rows)
          {
              mailBody += "&lt;tr&gt;";
              foreach (DataGridViewCell cell in row.Cells)
              {
                  mailBody += "&lt;td&gt;" + cell.Value + "&lt;/td&gt;";
              }
              {
                  mailBody += "&lt;/tr&gt;";
              }
          }
          mailBody += "&lt;/table&gt;";
  
          mail.Body = mailBody;
          client.Send(mail);
  </code></pre>