title: Adding a list of emails to wp_mail() in WordPress
body: <p>I am trying to add a list of email addresses to wp_mail() from a certain user role. I have a comma delimited list stored as <code>$user_email_list</code> but cannot get that to output into the <code>$multiple_recipients</code> array. </p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <pre><code>// Get users and their roles, create list of emails to send notification to.
      $user_args = array(
        'role__in' =&gt; 'test_role', 
        'orderby'  =&gt; 'user_nicename',
        'order'    =&gt; 'ASC'
      );
  
      $users = get_users($user_args);
  
      foreach ( $users as $user ) :
        $user_email_list = $user-&gt;user_email . ', ';
      endforeach;
  
  // Email Data
      $multiple_recipients = array(
          $user_email_list
      );
      $subject = $post-&gt;post_title;
      $body    = $post-&gt;post_content;
  </code></pre>