Problem with contact form script since upgrade to php 5.4

My hosting company recently upgraded their version of PHP to 5.4.4 and since many of my customers no longer received their contact form messages. When I tested by sending a contact form mesage to my own email address I received the test messages but only to some mailboxes. My scripts send a message which is delivered to my Hotmail, Gmail and Free mailboxes but not to SFR and Orange addresses, not even in the spam folder.
My Hosting company support team says my script is to blame because PHP 5.4 is stricter. What I don’t understand is PHP doesn’t return an error message on execution and mail() returns “true” when called. When I give a list of receivers addresses in the script, systematically addresses to the orange.fr and sfr.fr domains don’t arrive, yet the others do.
Here’s an example of the script I use.
//check existance of a POST variable
if (isset($_POST[‘civilite’])) {
//Load POST variables into internal variables
$civilite=$_POST[‘civilite’];
$nom=$_POST[‘nom’];
$prenom=$_POST[‘prenom’];
$tel=$_POST[‘telephone’];
$email=$_POST[‘email’];
$objet=$_POST[‘objet’];
$message=$_POST[‘message’];
//Prepare header
$adresse_to="[email protected], [email protected], [email protected], [email protected]";
$sujet=“Un message envoyé par un visiteur de notre site web”;
$corps=“Message envoyé par: “.$civilite.” “.$prenom.” “.$nom.”
”;
$corps.=“Téléphone: “.$tel.”
”;
$corps.=“E mail: “.$email.”
”;
$corps.=“Objet: “.$objet.”
”;
$corps.=“Message: “.$message.”
\n”;
$entete=“MIME-Version: 1.0\n”;
$entete.=“Content-Type:text/html;charset=iso-8859-1\n”;
$entete.=“Content-Transfer-Encoding: 8bit\n”;
$entete.=“From: “.$email.”\r\n”;
$entete.= “Return-Path: [email protected]\r\n”;
$entete.= ‘Bcc: [email protected]’ . “\r\n”;
$entete.= “X-Mailer: PHP/” . phpversion();
if(mail($adresse_to,$sujet,$corps,$entete))
{
header(“Location: contact.php?mail=1”);
}else{
header(“Location: contact.php?mail=2”);
}
}
HELP!!

To be honest I don’t think it’s your script…

If you have access take a look at the php.ini they are using, I bet they changed something due to the mail settings from the previous version…

I second Henry’s post. If the problem were to be your script, the other mail would not go through. Obviously I do not know your host, but everyone I have dealt with allows you to change the version you are using through your admin panel. If that is not the case, I would look for another provider.

Thanks guys for your reactions.

The hosting control panel does permit a choice between PHP versions 5.2, 5.3 and 5.4. though the hosting company has warned us that versions previous to 5.4 will only be available until August 2014.
It was when they upgraded by default to 5.4 that I began experiencing the non delivery of contact form emails to orange.fr and sfr.fr addresses. I immediately switched all my customers sites back to 5.2 and the problem disappeared - well temporarily anyway until august. I’ve been trying to figure out what’s going on and how to solve the problem since.

Thanks Topcoder for the suggestion about comparing the two PHP versions configuration to see if something is different.

For the moment I’m working under the hypothesis that a third party spam filter like Cloudmark or Barracuda could be deleting the emails before they even get to the Orange and SFR mailboxes. So I’m trying to figure out what detectable difference there might be between an email sent by PHP 5.2 and 5.4. Any ideas?

You can look at the release notes on what changed between versions…

http://www.php.net/manual/en/migration54.php

The only change I seen done to the mail function is that it now has a logging option.

Another option would be to port your code to use another mail system, I am a fan of PHPMailer.

After insisting that my problem would drive my business elsewhere, my hosting company put a competent network admin on the problem and after a few days of trial and error, he tweaked something in the server configuration (he didn’t tell me what) that solved the problem.
Thanks for all your help.

You should get them to tell you what they did, so if it happens again, you’ll know how to tell them to fix it.

Sponsor our Newsletter | Privacy Policy | Terms of Service