Envoi d'un email via php.
Bonjour, je suis en trains d'essayer de générer de email via un script php mais les accent ne passe pas le moins du monde, mon "HEADER" ne semble pas interprété a chaque fois ...
Mon script :
Et voila ce que je reçois dans mon mail :
"Vous faite maintenant parti des n=C3=83=C2=B4tres"
Si je change mon script avec ce qui est en commentaire dans mon script et la fonction utf8_encode a la place de quoted_printable_encode je reçois toujours pas mes accents ... snif
voici le header quand je le reçois :
Subject: Vous faite maintenant parti des n=C3=83=C2=B4tres !
To: moi@hotmail.com
X-PHP-Originating-Script: 0:fonction.php
From: Benj <machin@truc@gmail.com>
Reply-to: Benj <machin@truc@gmail.com>
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Antivirus: avast! (VPS 121117-1, 17/11/2012), Outbound message
X-Antivirus-Status: Clean
Return-Path: machin@truc@gmail.com
X-OriginalArrivalTime: 18 Nov 2012 08:44:09.0414 (UTC) FILETIME=[E04EBE60:01CDC568]
Si vous avez une solution je suis preneur ... car la je suis un peu perdu ...
Mon script :
$headers = "From: Benj <machin@truc.com> \r\n"; $headers.= "Reply-to: Benj <machin@truc.com> \r\n"; $headers.= 'MIME-Version: 1.0' . " \r\n "; $headers .= "Content-Type: text/html; charset=ISO-8859-1 "; $headers .= "Content-Transfer-Encoding: quoted-printable"; // $headers .= "Content-Type: text/html; charset=ISO-8859-1 \r\n "; // $headers .= "Content-Transfer-Encoding: 8bit \r\n "; $message =nl2br($msg); mail($des, quoted_printable_encode ($suj), quoted_printable_encode ($message), $headers);
Et voila ce que je reçois dans mon mail :
"Vous faite maintenant parti des n=C3=83=C2=B4tres"
Si je change mon script avec ce qui est en commentaire dans mon script et la fonction utf8_encode a la place de quoted_printable_encode je reçois toujours pas mes accents ... snif
voici le header quand je le reçois :
Subject: Vous faite maintenant parti des n=C3=83=C2=B4tres !
To: moi@hotmail.com
X-PHP-Originating-Script: 0:fonction.php
From: Benj <machin@truc@gmail.com>
Reply-to: Benj <machin@truc@gmail.com>
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Antivirus: avast! (VPS 121117-1, 17/11/2012), Outbound message
X-Antivirus-Status: Clean
Return-Path: machin@truc@gmail.com
X-OriginalArrivalTime: 18 Nov 2012 08:44:09.0414 (UTC) FILETIME=[E04EBE60:01CDC568]
Si vous avez une solution je suis preneur ... car la je suis un peu perdu ...
1 réponse
-
Bon je me répond en tatonant un peu ... j'ai trouvé une solution :
$headers = "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "From: Benj <benj.jeremy@gmail.com> \r\n"; $headers.= "Reply-to: Benj <benj.jeremy@gmail.com> \r\n"; $headers.= 'MIME-Version: 1.0' . "\r\n"; mail($des, utf8_decode ($suj), utf8_decode ($message), $headers);
et ça marche mes accents et caractère spéciaux arrivent entier ...