PHP contact form results in junk mail folder

I have several contact forms on my websites. they worked fine until a recent PHP upgrade to the server. After modifying the code on my contact forms, they once again send me mail. The only problem is, now the mail goes into my junk mail folder, regardless of the settings I use to avoid that. I use Outlook for email and I have the junk mail filter on low. Below is the code I use to send the email



$subject = “Contact Message from DMCA Website”;
$headers .= ‘Return-Path:’ . “<$email> \r\n”;
$headers .= ‘From:’ . “$name<$email> \r\n”;
$headers .= “X-Mailer: PHP/” . phpversion(); “\r\n”;
$headers .= ‘X-Priority: 1’ . “\r\n”;
$message .= “Contact Form Submitted: \r\n”;
$message .= “$formName \r\n”;
$message .= “Page: \r\n”;
$message .= “Contact Page, located at: \r\n”;
$message .= “$formLocation \r\n”;
$message .= “A contact form was submitted on: \r\n”;
$message .= “$submittime \r\n”;
$message .= “By: \r\n”;
$message .= “$name \r\n”;
$message .= “Your IP Address has been logged: \r\n”;
$message .= “$visitorIp \r\n”;
$message .= “Your browser info: \r\n”;
$message .= “$visitorData \r\n”;
$message .= " \r\n";
$message .= “Your E-mail address: \r\n”;
$message .= “$email \r\n”;
$message .= “\r\n”;
$message .= “Your Comments: \r\n”;
$message .= “$comments \r\n”;

mail($contactEmail, $subject , $message, $headers);

The variables are all taken from the form. The form does almost everything as expected. The mail is sent with all the data intact. The only issue is it goes into the junk mail folder. Outlook has in the settings to allow any mail that includes (for this form) Contact Message from DMCA Website and put it in the correct folder. Each form has $subject set on the page. I have tried changing junk mail settings in Outlook with no success. The only change has been the PHP upgrade, which makes me thing the error is a PHP coding error.

Update, of sorts. If I run my manually written rules on any of the form generated emails in the junk mail folder, they go to the proper folder. This tells me the emails conform to the rules, they are just sending some sort of “Junk mail” alert before they get to the Outlook rules.

I also alerted my hosting company to this issue. One of the techs sent me a message through the form on my website and it went where it was supposed to go, making me more confused.

Sponsor our Newsletter | Privacy Policy | Terms of Service