Answers.Body: <pre><code>$email-&gt;cc = array(
      array('email' =&gt; 'cc1@example.com', 'name' =&gt; 'Person One'),
      // ...
  );
  </code></pre>
  
  <p>If you want emails recipients to see other recipients listed in the email, use 'cc'; otherwise, use the loop as the other answer suggested, or 'bcc'.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-15T04:42:16.460Z
Answers.LastActivityDate: 2019-01-15T05:05:06.587Z
Answers.LastEditDate: 2019-01-15T05:05:06.587Z
Answers.UserDisplayName: Wei
Answers.Body: <p>You can loop through a list of your recipients:</p>
  
  <pre><code>// Comma-separated list of recipients
  $recipients = 'person1@example.com, person2@example.com';
  
  // Break out recipients into an array
  $recipientList = explode( ",", $recipients );
  
  // Create the globally known things about the EmailModel
  $email = new EmailModel();
  $email-&gt;subject = 'My Email Subject';
  $email-&gt;body    = 'My Email Body';
  
  // Loop through each recipient in the recipient list
  foreach ( $recipientList as $recipient )
  {
      try
      {
          // Add a specific recipient to the email model
          $email-&gt;toEmail = $recipient;
  
          // Send the email
          craft()-&gt;email-&gt;sendEmail( $email );
      }
      catch ( \Exception $e )
      {
          // Do nothing
          return false;
      }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-20T22:13:04.707Z
Answers.Text: Why not use cc?
Answers.UserDisplayName: Jason Galuten
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T05:06:36.947Z
Answers.Text: This worked perfectly! I'm a little bummed that "toEmail" is incapable of handling multiple email addresses (since the [PHP mail function](http://www.php.net/manual/en/function.mail.php) can handle multiple recipients with no problem), but your solution did the trick as a solid workaround. Thanks Ben!
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T01:10:11.147Z
Answers.LastActivityDate: 2014-06-25T04:58:31.410Z
Answers.LastEditDate: 2014-06-25T04:58:31.410Z
Answers.UserDisplayName: Ben Parizek
Body: <p>In my plugin, I'm sending an email like this:</p>
  
  <pre><code>$recipients = 'person@example.com';
  
  $email = new EmailModel();
  $email-&gt;toEmail = $recipients;
  $email-&gt;subject = 'My Email Subject';
  $email-&gt;body    = 'My Email Body';
  
  craft()-&gt;email-&gt;sendEmail($email);
  </code></pre>
  
  <p>Which works great! But when I'm sending to multiple people, the string would look like this...</p>
  
  <pre><code>$recipients = 'person1@example.com, person2@example.com';
  </code></pre>
  
  <p>... and it generates an error:</p>
  
  <pre><code>Invalid address: person1@example.com, person2@example.com
  </code></pre>
  
  <p><strong>How do I properly send an email to multiple recipients?</strong></p>
  
Tags: <plugin-development><emails>
Title: How do I send an email to multiple recipients?
ThreadText: # How do I send an email to multiple recipients?
  
  (Asked by: username_0 on 2014-06-25)
  
  In my plugin, I'm sending an email like this:
  
  ```
  $recipients = 'person@example.com';
  
  $email = new EmailModel();
  $email->toEmail = $recipients;
  $email->subject = 'My Email Subject';
  $email->body    = 'My Email Body';
  
  craft()->email->sendEmail($email);
  
  ```
  
  Which works great! But when I'm sending to multiple people, the string would look like this...
  
  ```
  $recipients = 'person1@example.com, person2@example.com';
  
  ```
  
  ... and it generates an error:
  
  ```
  Invalid address: person1@example.com, person2@example.com
  
  ```
  
  **How do I properly send an email to multiple recipients?**
  
  **Tags:** plugin-development, emails
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-25. Score: 7 | Accepted answer
  
  You can loop through a list of your recipients:
  
  ```
  // Comma-separated list of recipients
  $recipients = 'person1@example.com, person2@example.com';
  
  // Break out recipients into an array
  $recipientList = explode( ",", $recipients );
  
  // Create the globally known things about the EmailModel
  $email = new EmailModel();
  $email->subject = 'My Email Subject';
  $email->body    = 'My Email Body';
  
  // Loop through each recipient in the recipient list
  foreach ( $recipientList as $recipient )
  {
      try
      {
          // Add a specific recipient to the email model
          $email->toEmail = $recipient;
  
          // Send the email
          craft()->email->sendEmail( $email );
      }
      catch ( \Exception $e )
      {
          // Do nothing
          return false;
      }
  }
  
  ```
  
  > **Comments:**
  > **username_0**: This worked perfectly! I'm a little bummed that "toEmail" is incapable of handling multiple email addresses (since the [PHP mail function](http://www.php.net/manual/en/function.mail.php) can handle multiple recipients with no problem), but your solution did the trick as a solid workaround. Thanks Ben!  
  > **username_3**: Why not use cc?  
  
  ---
  
  ### Answer by username_1 on 2019-01-15. Score: 1
  
  ```
  $email->cc = array(
      array('email' => 'cc1@example.com', 'name' => 'Person One'),
      // ...
  );
  
  ```
  
  If you want emails recipients to see other recipients listed in the email, use 'cc'; otherwise, use the loop as the other answer suggested, or 'bcc'.
  
  
  ---
  
  