title: Send Bulk Email to Groups Using SMTP
body: <p>Please consider the following:</p>
  
  <p><strong>1. Departments Table:</strong></p>
  
  <hr>
  
  <pre><code>DeparmentId | DepartmentName 
  ____________________________
  1           | Sales
  2           | Finance
  3           | I.T
  4           | HR
  5           | Management
  </code></pre>
  
  <h2><strong>2. Employees Table</strong></h2>
  
  <pre><code>EmployeeId  | EmployeeName  | EmployeeEmail      | DepartmentId
  ________________________________________________________________
  1           | Sarah         | sarah@domain.com   | 2
  2           | David         | david@domain.com   | 5
  3           | Mark          | mark@domain.com    | 5
  4           | John          | john@domain.com    | 1
  5           | Arthur        | arthur@domain.com  | 3
  </code></pre>
  
  <p>I want to send an email via <code>SMTP</code> to employees belonging to a department group. If this was a database say with 50 employees, I could do a look up function like so:</p>
  
  <pre><code>private void EmailEmployeeDepartment(int DeptartmentId)
  {
      SmtpClient mailClient = new SmtpClient("HostName");
      MailMessage msgMail = new MailMessage(); 
  
      if(DeptartmentId == 5)
      {
          var mailCollection = new MailAddressCollection()
          {
             new MailAddress("sarah@domain.com", "Sarah"),
             new MailAddress("mark@domain.com", "Mark")
          }; 
  
          foreach(var sendMailTo in mailCollection) 
          {
             msgMail.To.Add(sendMailTo);
          }
  
          msgMail.Subject = "Subject Text";
          msgMail.Body = "Email text";
          msgMail.IsBodyHtml = true;
      }
      else if(DeptartmentId == 1)
      {
          //Map other employees belonging to assigned DepartmentId
      }
  }
  </code></pre>
  
  <p>But for a database housing hundreds of employees that need to be emailed periodically as per their DepartmentId in my given scenario - How can I achieve this using <code>SMTPClient</code>?</p>
  
  <p>So basically my logic requires that I send an email to all users belonging to a specific department. If I send to <code>Management</code> then only <code>Sarah</code> and <code>Mark</code> should receive the email. This is for my C# Windows Forms Application.</p>