title: PHP Foreach Loop mail()
body: <p>My following script runs fine when a single email address is entered into the textarea, but once two are entered, no emails are sent. What am I doing wrong?</p>
  
  <pre><code>if($_POST['submit']=='Send Email') {
  
  $email_addresses = explode(",\n", $_POST['email']);
  
  foreach($email_addresses as $email_address){
  
  $email_address = trim($email_address);
  
  send_mail(  'noreply@noreply.com',
                          $email_address,
                          'Test Email',
                          "Hello This Email Is A Test");
  
  }
  
  
  }
  </code></pre>
  
  <p>var_dump($email_addresses) results in this</p>
  
  <pre><code>array(1) { [0]=&gt; string(39) "email1@test.com email2@test.com" }
  </code></pre>