title: PHP mail() form sending to GMAIL spam
body: <p>I know this problem has been addressed a few times on here.  I tried following the directions for setting proper headers, I still run into problems with my emails going into the spam filter in Gmail. </p>
  
  <p>If anyone can please take a look at what I've tried, I'd really appreciate it.  The code below is without the headers added as explained here: <a href="http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/" rel="noreferrer">http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/</a></p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>define("WEBMASTER_EMAIL", 'myName@mydomain.com');
  if($post)
  {
      $name    = stripslashes($_POST['name']);
      $email   = trim($_POST['email']);
      $subject = trim($_POST['subject']);
      $message = stripslashes($_POST['message']);
  
      $error = '';
  
      // Check name
      if(!$name)
          $error .= 'Name required! ';
  
      // Check email
      if(!$email)
          $error .= 'E-mail required! ';
  
      if($email &amp;&amp; !ValidateEmail($email))
          $error .= 'E-mail address is not valid! ';
  
      // Check message
      if(!$message)
          $error .= "Please enter your message!";
  
      if(!$error)
      {
  
          $mail = mail(WEBMASTER_EMAIL, $subject, $message,
              "From: ".$name." &lt;".$email."&gt;\r\n"
              ."Reply-To: ".$email."\r\n"
              ."X-Mailer: PHP/" . phpversion());
  
          if($mail)
              echo 'OK';
      }
      else
          echo '&lt;div class="errormsg"&gt;'.$error.'&lt;/div&gt;';
  }
  </code></pre>