email using array from foreach
<p>Any help would be appreciated.</p>

<pre><code>$divisions = explode(",", $entry-&gt;dept);

foreach($divisions as $division) {
     $divs=get_record('induction_emails','id',$division);

$useremail = get_record('user', 'email', $divs-&gt;email);

    $to = get_record('user', 'id', $useremail-&gt;id);  }

if (email_to_user($to, $from, $subject, $body)){    

redirect('thanks.php'); die;

}  else {

} ?&gt;
</code></pre>

<p>Works great when emailing one person but when you try to email a few in the array it does not work.</p>
