I've got a PHP page that sends email from a HTML form. The email sends, but it's being flagged by Hotmail as spam. I've replaced the actual email addresses in the code.
<?php
function clean_string($string){
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$name=$_POST['name'];
$email=$_POST['email'];
$subj=$_POST['subject'];
$body=$_POST['body'];
$email_subject='Website name - '.$subj;
$email_message="<html><body><p>".clean_string($body)."</p><p>".$name."<br>".$email."</p></body></html>";
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = "From:email@email.com";
$headers[] = "Reply-To:".$name."<".$email.">";
$header=implode("\r\n",$headers);
if(mail('email@email.com',$email_subject,$email_message,$header)==true){header('location: http://julie-mosaics.dx.am/index.php?page=contact&result=success');} else {header('location: http://julie-mosaics.dx.am/index.php?page=contact&result=fail');}
?>
This is hotmail's error message.
Content analysis details: (7.1 points, 7.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 HTML_MESSAGE BODY: HTML included in message
1.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.1 MISSING_MID Missing Message-Id: header
0.0 FROM_MISSP_DKIM From misspaced, DKIM dependable
1.4 MISSING_DATE Missing Date: header
2.5 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From
2.0 FROM_12LTRDOM From a 12-letter domain