Syntaxe fonction php envoi mail
pixelrulez
-
Brachior Messages postés 616 Statut Membre -
Brachior Messages postés 616 Statut Membre -
Bonjour,
Voila je fais une page php qui me permet de récupérer une adresse email d'un formulaire et d'envoyer un email de confirmation à l'adresse saisie.
pour cela j'utilise une fonction php mais quand je teste ma page il renvoi mon code en texte donc si quelqu'un pourrait m'indiquer quelle est la syntaxe à utiliser ce serait très sympa.
voici le code
// fonction envoie du message de confirmation vers la personne qui s'inscrit
function sendMsg($to, $toEmail, $sub, $msg, $from, $fromEmail) {
//Compose headers for plain text email
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n"; //The mailer name
$headers .= "From: ".$from."<".$fromEmail.">\r\n";
$headers .= "Reply-to: ".$from."<".$fromEmail.">\r\n";
//Compose recipient
$recipient = empty($to) ? $toEmail : $to."<".$toEmail.">";
return mail($recipient, $sub, $msg, $headers);
}
voici la partie renvoyée en texte à l'éxécution de la page :
\r\n"; $headers .= "Reply-to: ".$from."<".$fromEmail.">\r\n"; //Compose recipient $recipient = empty($to) ? $toEmail : $to."<".$toEmail.">"; return mail($recipient, $sub, $msg, $headers); }
Voila je fais une page php qui me permet de récupérer une adresse email d'un formulaire et d'envoyer un email de confirmation à l'adresse saisie.
pour cela j'utilise une fonction php mais quand je teste ma page il renvoi mon code en texte donc si quelqu'un pourrait m'indiquer quelle est la syntaxe à utiliser ce serait très sympa.
voici le code
// fonction envoie du message de confirmation vers la personne qui s'inscrit
function sendMsg($to, $toEmail, $sub, $msg, $from, $fromEmail) {
//Compose headers for plain text email
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n"; //The mailer name
$headers .= "From: ".$from."<".$fromEmail.">\r\n";
$headers .= "Reply-to: ".$from."<".$fromEmail.">\r\n";
//Compose recipient
$recipient = empty($to) ? $toEmail : $to."<".$toEmail.">";
return mail($recipient, $sub, $msg, $headers);
}
voici la partie renvoyée en texte à l'éxécution de la page :
\r\n"; $headers .= "Reply-to: ".$from."<".$fromEmail.">\r\n"; //Compose recipient $recipient = empty($to) ? $toEmail : $to."<".$toEmail.">"; return mail($recipient, $sub, $msg, $headers); }
Configuration: Windows XP Firefox 2.0.0.14