PHP mail() form sending to GMAIL spam

Use this code :

 $to = Email;
 $subject = subject ;
 $body = "<div> hi hi .. </div>";

    $headers = 'From: YourLogoName [email protected]' . "\r\n" ;
    $headers .='Reply-To: '. $to . "\r\n" ;
    $headers .='X-Mailer: PHP/' . phpversion();
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";   
if(mail($to, $subject, $body,$headers)) {
  echo('<br>'."Email Sent ;D ".'</br>');
  } 
  else 
  {
  echo("<p>Email Message delivery failed...</p>");
  }

I think this is your issue:

 "From: ".$name." <".$email.">\r\n"

since you are not gmail, hotmail or your users email provider, you cannot have "From: otherdomain.com" and then deliver the mail via "mail.yourdomain.com" - this will most likely move your mail to the spam folder.

Try

 "From: YourWebsiteName <[email protected]>\r\n"
."Reply-To: ".$name." <".$email.">\r\n"

instead.

ALso: your code is very unsave and a prime spam target - google "email header injection php"!