This question already has an answer here:
When I send my mail with my PHP, the mail is empty, it's maybe because there is a probleme with the I think. I don't have an idea to resolve this.
<?php
$mail = 'adrien.collery@gmail.com';
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail))
{
$passage_ligne = "
";
}
else
{
$passage_ligne = "
";
}
$message_txt = "Salut à tous, voici un e-mail envoyé par ";
$boundary = "-----=".md5(rand());
$sujet = "Hey mon ami !";
$header = "From: \"AC\"<adrien.collery@gmail.com>".$passage_ligne;
$header.= "Reply-to: \"AC\" <adrien.collery@gmail.com>".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
$header .= "X-Priority: 3".$passage_ligne;
$header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne;
$message = $passage_ligne."--".$boundary.$passage_ligne;
$message.= "Content-Type: text/plain; charset=\"ISO-8859-1\"".$passage_ligne;
$message.= "Content-Transfer-Encoding: 8bit".$passage_ligne;
$message.= $passage_ligne.$message_txt.$passage_ligne;
$message.= $passage_ligne."--".$boundary.$passage_ligne;
$message.= $passage_ligne."--".$boundary."--".$passage_ligne;
$message.= $passage_ligne."--".$boundary."--".$passage_ligne;
var_dump(mail($mail,$sujet,$message,$header));
?>
</div>
Can you remove the à and the é in $message_txt = "Salut à tous, voici un e-mail envoyé par ";
to see if this helps?
Remove your ----- from $boundary
$boundary = "-----=".md5(rand());
Should look like his
$boundary = md5(rand();
and remove $passage_ligne after Content-Type value.
$header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne;
Should look like this:
$header.= "Content-Type: multipart/alternative; boundary=\"$boundary\"".$passage_ligne;