title: PHP Email sending BCC
body: <p>I know there are a few similar questions to this but I just can't get it working.</p>
  
  <p>Ok, I have a list of emails grabbed from my database in a variable called $emailList. 
  I can get my code to send an email from a form if I put the variable in the <code>$to</code> section but
  I cannot get it to work with bcc. I've even added an email to the <code>$to</code> incase it was that but it doesn't make a difference.  </p>
  
  <p>Here is my code.</p>
  
  <pre><code>$to = "name@mydomain.com";
  $subject .= "".$emailSubject."";
  $headers .= 'Bcc: $emailList';
  $headers = "From: no-reply@thepartyfinder.co.uk\r\n" . "X-Mailer: php";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  $message = '&lt;html&gt;&lt;body&gt;';
  $message .= 'THE MESSAGE FROM THE FORM';
  
  if (mail($to, $subject, $message, $headers)) {
      $sent = "Your email was sent!";
  } else {
      $sent = ("Error sending email.");
  }
  </code></pre>
  
  <p>I've tried both codes:</p>
  
  <pre><code>$headers .= 'Bcc: $emailList';
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$headers .= 'Bcc: '.$emailList.';
  </code></pre>
  
  <p>It's not that the emails aren't separated because they are. I know they are because it works if I put <code>$emailList</code> in the <code>$to</code> section. </p>
  
  <hr>
  
  <p>I Should add, ignore the <code>$message</code> bits and the HTML stuff. I've not provided all of that so that is why it's missing from this code. </p>