title: How can I stop gmail from blocking mail from PHP script?
body: <p>I created a website to send a letter to Santa (actually sends it to your parents) and it works perfectly fine on all of my email accounts. I have received feedback that Gmail is ignoring the emails, so I tested it and sure enough they never show up. I'm guessing it has to do with my email headers? I'm not experienced enough at PHP to know how to change the from address to not be from the recipient.</p>
  
  <pre><code>$headers = 'From: '.$email_from."\r\n".
  'Reply-To: '.$email_from."\r\n" .
  'X-Mailer: PHP/' . phpversion();
  @mail($email_to, $email_subject, $email_message, $headers);
  </code></pre>
  
  <p>Those are my headers. The full PHP can be found at <a href="https://pastebin.com/SLtZ6GxN" rel="nofollow noreferrer">https://pastebin.com/SLtZ6GxN</a> and the html can be found on the website at dearsanta.fun</p>
  
  <p>Thanks for reading.</p>
  
  <p>I tried changing the headers to:</p>
  
  <pre><code>$headers = 'From: santa@dearsanta.fun' . "\r\n".
  'Reply-To: santa@dearsanta.fun' "\r\n" .
  'X-Mailer: PHP/' . phpversion();
  @mail($email_to, $email_subject, $email_message, $headers);
  </code></pre>
  
  <p>and now on submit I am redirected to a white page and the address it to the php form. So the answer given in the other thread seems to have broken my script. </p>