[PEAR Mail Mime] HTML visible dans le mail
Bonjour,
Mes mails envoyés avec la classe Mail_Mime de PEAR laissent apparaitre le code HTML.
Le mail commence ainsi :
Citation:
--=_7551249fa18f29b037a02e0f89fa70ac
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="ISO-8859-1"
Bonjour M Bigltnt,
Blablablabla
cliquez sur le lien ci-dessous pour le télécharger :
http://monsite/231.pdf
--=_7551249fa18f29b037a02e0f89fa70ac
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" />
<title>monsite</title>
...
Ce qui correspond a ma version texte, suivie de la version HTML.
Je pense pas que la source du mail soit importante, mais voici le début au cas ou:
Citation:
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MTtTQ0w9MQ==
X-Message-Status: sF:0
X-SID-PRA: Camille Albane <no-reply@monsite.fr>
X-Message-Info: JGTYoYF78jFQ7z863L2XVTlEf5o8XDzBbGga7x+Aw5I7Jnnk2IW4k6r/2tnMqucrRASB3ayv9h9N1w12Uzb8kN4yPIMJConI
Et voici mon code poyur envoyer le mail:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| include('Mail.php');
include('Mail/mime.php');
$mime = new Mail_Mime("\r\n");
$mime->setTXTBody( $text_template->render() );
$mime->setHTMLBody($html_template->render());
$recipients = $addr_to;
$hdrs = array(
'From' => $this->_mail_options[ 'from' ][ 1 ]."<".$this->_mail_options[ 'from' ][ 0 ].">",
'To' => $addr_to,
'Subject' => $this->_mail_options[ 'subject' ]
);
$headers = $mime->headers($hdrs);
$body = $mime->get();
// Create the mail object using the Mail::factory method
$smtpinfo["host"] = SMTP_SERVER;
$smtpinfo["port"] = SMTP_PORT;
$smtpinfo["auth"] = true;
$smtpinfo["username"] = SMTP_LOGIN;
$smtpinfo["password"] = SMTP_PASSWORD;
$mail_object =& Mail::factory("smtp", $smtpinfo);
$mail_object->send($recipients, $headers, $body); |
Franchement l'encodage c'est relou ... :calim2: A vot bon coeur pour m'aider sur ce problème. Merki