I have an email function in php:
function send_mail($to, $from, $objet, $message) {
$entetemail = 'MIME-Version: 1.0' . "
";
$entetemail .= 'Content-type: text/plain; charset=UTF-8' . "
";
$entetemail .= 'From: '.$from. "
";
$entetemail .= 'Cc: ' . "
";
$entetemail .= 'Bcc: ' . "
";
$entetemail .= 'Reply-To: '.$from .''. "
";
$entetemail .= 'X-Mailer: PHP/' . phpversion() . "
" ;
$entetemail .= 'Date: '. date("D, j M Y H:i:s -0600");
return mail($to, $objet, $message, $entetemail);
}
$to is a valid email address. $from looks like:
Firstname name <email@example.com>
$objet and $message come respectivelly from an input texte and a textarea.
I've got no PHP errors and mail send me false back.
After an echo, my header looks like on bothe servers:
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
From: Firstname Name
Cc:
Bcc:
Reply-To: Firstname Name
X-Mailer: PHP/4.4.9
Date: Fri, 18 Feb 2011 23:35:58 -0600
On my local server everything is fine. But on the production one, the From line gives an issue because of the $from variable. The email will not be send. Have I done something wrong? Is there a server configuration which break everything?