title: PHP Errors when using form validator
body: <p>I'm getting following PHP Errors when using a Contact form, which worked fine until the client said that they aren't receiving emails since a week. As a friend helped me with the backend, and hes not available right now to ask, I wanted to ask kindly if you could give me a hint what I would need to fix. </p>
  
  <p>The Errors:</p>
  
  <p>`[Wed Feb 17 16:43:44 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Notice:  Undefined variable: headers in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 29, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a></p>
  
  <p>[Wed Feb 17 16:43:44 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Warning:  mail(): Multiple or malformed newlines found in additional_header in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 32, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a></p>
  
  <p>[Wed Feb 17 16:45:18 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Notice:  Undefined variable: headers in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 29, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a></p>
  
  <p>[Wed Feb 17 16:45:18 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Warning:  mail(): Multiple or malformed newlines found in additional_header in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 32, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a></p>
  
  <p>[Wed Feb 17 17:02:25 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Notice:  Undefined index: name in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 12</p>
  
  <p>[Wed Feb 17 17:02:25 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Notice:  Undefined index: email in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 13</p>
  
  <p>[Wed Feb 17 17:02:25 2016] [warn] [client 37.24.118.150] mod_fcgid: stderr: PHP Notice:  Undefined index: message in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 14</p>
  
  <p>[Thu Feb 18 09:40:15 2016] [warn] [client 213.23.122.15] mod_fcgid: stderr: PHP Notice:  Undefined variable: headers in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 29, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a></p>
  
  <p>[Thu Feb 18 09:40:15 2016] [warn] [client 213.23.122.15] mod_fcgid: stderr: PHP Warning:  mail(): Multiple or malformed newlines found in additional_header in /var/www/vhosts/wscgmbh.de/httpdocs/php/contact-form-handler.php on line 32, referer: <a href="http://www.wscgmbh.de/contact.html" rel="nofollow">http://www.wscgmbh.de/contact.html</a>`</p>
  
  <hr>
  
  <p>This is the Code of the form-handler which worked the whole time, but suddenly doesnt</p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html"; charset="utf-8" /&gt;
   &lt;?php 
  $errors = '';
  $myemail = 'service@wscgmbh.de';
  if(empty($_POST['name'])  || 
  empty($_POST['email']) || 
  empty($_POST['message']))
  {
  $errors .= "\n Error: all fields are required";
  }
  
  $name = $_POST['name']; 
  $email_address = $_POST['email']; 
  $message = $_POST['message']; 
  
  if (!preg_match(
  "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]    {2,3})$/i", 
  $email_address))
  {
  $errors .= "\n Error: Invalid email address";
  }
  
  if( empty($errors))
  {
  $to = $myemail; 
  $email_subject = "Sie haben eine neue Nachricht von: $name";
  $email_body = "Sie haben eine neue Nachricht erhalten, hier sind die     Details: \n\nName: $name \nEmail: $email_address \nNachricht: \n$message"; 
  
  $headers [] .= 'From: WSC-Kontaktformular' . "\r\n";
  $headers [] = "Antworten Sie: {$email_address}";
  
  mail($to,$email_subject,$email_body,implode("\r\n",$headers));
  //redirect to the 'thank you' page
  
  echo '&lt;script&gt; 
          alert("Danke für Ihre Nachricht. Wir werden uns bald bei  melden!");
          window.location = "http://www.wscgmbh.de"
      &lt;/script&gt;';
   } 
   ?&gt;
  </code></pre>
  
  <hr>
  
  <p>Im not an expert and PHP, so I really hope somebody could help me!
  Thank you very much in advance!!!</p>