title: How to determine the time it took SmtpClient.send to send the message?
body: <p>@Title</p>
  
  <p>How do I determine the time it took to send the message?</p>
  
  <p>Right now, when I click "send", my program simply is silent. I would like the program to show something like a progress bar that will load while the program is sending the message.</p>
  
  <p>Is that possible?</p>
  
  <p>As of the moment, this is what I have:</p>
  
  <pre><code>            try
              {
                  MySqlDataAdapter adapter = new MySqlDataAdapter();
                  MySqlCommand cmd = new MySqlCommand(getEmail, connect.connection);
                  cmd.Parameters.AddWithValue("@section", sectionSelect.SelectedValue);
  
                  adapter.SelectCommand = cmd;
  
                  System.Data.DataTable mailingList = new System.Data.DataTable();
  
                  adapter.Fill(mailingList);
  
                  foreach (DataRow row in mailingList.Rows)
                  {
                      string rows = string.Format("{0}", row.ItemArray[0]);
                      message.To.Add(rows);
                  }
  
                  SmtpClient client = new SmtpClient();
  
                  client.Credentials = new NetworkCredential(email, password.Password);
                  client.Host = "smtp.gmail.com";
                  client.Port = 587;
                  client.EnableSsl = true;
  
                  client.Send(message);
              }
              catch (System.Exception ex)
              {
                  MessageBox.Show(ex.ToString());
              }
  
              finally
              {
                  MessageBox.Show("Your message has been sent.");
              }
  </code></pre>