title: c# continue code in try even if it catches exception
body: <p>I created an email app, which sends email to all users in database, but I have a problem, where if users email is invalid, try catch shows an exception and stop sending letters to others. Heres my try catch code</p>
  
  <pre><code>try
  {
      foreach (string item in risto)
      {
          AlternateView avHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
  
          MailMessage mail = new MailMessage(txtBEmail.Text, item, txtBTema.Text, rtxtBContent.Text);
          mail.AlternateViews.Add(avHtml);
          // SmtpServer = smtp.company.com; Ex: Gmail - smtp.gmail.com | Yahoo - smtp.yahoo.com
          SmtpClient client = new SmtpClient("mail.mailExample.com");
          client.Port = 587;
  
  
          client.Credentials = new System.Net.NetworkCredential(txtBEmail.Text, txtBPass.Text);
          client.EnableSsl = false;
          client.Send(mail);
          progressBar1.Visible = true;
          progressBar1.Increment(1);
      }
  
      MessageBox.Show("Sent", MessageBoxButtons.OK);
      txtBEmail.Text = "";
      txtBPass.Text = "";
      txtBTema.Text = "";
      txtBPic.Text = "";
      txtBLink.Text = "";
      rtxtBContent.Text = "";
  }
  catch (Exception ex)
  {
      MessageBox.Show("Bad data" + ex);
      txtBEmail.Text = "";
      txtBPass.Text = "";
      txtBTema.Text = "";
      txtBPic.Text = "";
      txtBLink.Text = "";
      rtxtBContent.Text = "";
  }
  </code></pre>