title: PHP Contact Form keeps getting spam
body: <p>my contact form keeps getting spam everyday. Not sure why. Here is contact-process.php to process a submission:</p>
  
  <pre><code>            &lt;?php
  
              // configure
              $from = 'webmaster@example.com'; 
              $sendTo = 'Message from &lt;myemail@mydomain.com&gt;';
              $subject = "Contact Form: $name";
              $fields = array('name' =&gt; 'Name', 'surname' =&gt; 'Surname', 'phone' =&gt; 'Phone', 'email' =&gt; 'Email', 'message' =&gt; 'Message'); // array variable name =&gt; Text to appear in the email
              $human = intval($_POST['humans']);
              $okMessage = 'Contact form successfully submitted. Thank you, I will get back to you soon!';
              $errorMessage = 'There was an error while submitting the form. Please try again later';
              $headers = 'From: webmaster@example.com' . "\r\n" .
                  'Reply-To: webmaster@example.com' . "\r\n" .
                  'X-Mailer: PHP/' . phpversion();
              // let's do the sending
  
              try
              {
                  $emailText = "You have new message from contact form\n=============================\n";
  
                  foreach ($_POST as $key =&gt; $value) {
  
                      if (isset($fields[$key])) {
                          $emailText .= "$fields[$key]: $value\n";
                      }
                  }
  
  
                  mail($sendTo, $subject, $emailText, implode("\n", $headers));
  
                  $responseArray = array('type' =&gt; 'success', 'message' =&gt; $okMessage);
  
                      header('Location: /thank-you.php');
              }
              catch (\Exception $e)
              {
                  $responseArray = array('type' =&gt; 'danger', 'message' =&gt; $errorMessage);
              }
  
              if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;&amp; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
                  $encoded = json_encode($responseArray);
  
                  header('Content-Type: application/json');
  
                  echo $encoded;
              }
              else {
                  echo $responseArray['message'];
              }
  
  
              //Check if simple anti-bot test is correct
              if(!empty($_POST['humans'])) {
                  // it's spam
              } else {
                  // it's human
              }
  </code></pre>
  
  <p>I have no idea why this is happening, I also set up a honeypot as well. Also the emails are coming in as being sent from hostname, not from the individual email addresses themselves.</p>
  
  <p>Thanks for the help guys.</p>