Pear Mail, comment envoyer du texte / texte + texte / html en UTF-8

Je suis en train d'envoyer un e-mail à la fois du texte et html, mais je ne peux pas envoyer correctement la droite des en-têtes. En particulier, je tiens à définir le Type de Contenu d'en-tête, mais je ne trouve pas comment l'installer séparément pour le html et le texte des pièces.

C'est mon code:

$headers = array(
  'From'          => '[email protected]',
  'Return-Path'   => '[email protected]',
  'Subject'       => 'mysubject',
  'text_encoding' => '7bit',
  'text_charset'  => 'UTF-8',
  'html_charset'  => 'UTF-8',
  'head_charset'  => 'UTF-8',
  'Content-Type'  => 'text/html; charset=UTF-8'
);

$mime = new Mail_mime();

$html = '<html><body><b>my body</b></body></html>';
$text = 'my body';

$mime->setTXTBody($text);
$mime->setHTMLBody($html);

$body = $mime->get();
$headers = $mime->headers($headers);
$mail_object =& Mail::factory('smtp', $GLOBALS['pear_mail_config']);
$mail_object->send('[email protected]', $headers, $body);

Que l'e-mail que je reçois:

From: info@mydomain.com
Subject: mysubject
text_encoding: 7bit
text_charset: UTF-8
html_charset: UTF-8
head_charset: UTF-8
Content-Type: multipart/alternative;
    boundary="=_7adf2d854b1ad792c802a9db31084520"
Message-Id: <.....cut.....>
Date: Mon,  8 Oct 2012 15:40:54 +0200 (CEST)
To: undisclosed-recipients:;

--=_7adf2d854b1ad792c802a9db31084520
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="ISO-8859-1"

my body

--=_7adf2d854b1ad792c802a9db31084520
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="ISO-8859-1"

<html><body><b>my body</b></body></html>
--=_7adf2d854b1ad792c802a9db31084520--

Il semble que le Contenu de l'en-tête de Type I ensemble est totalement ignorée. J'aurais attendu quelques setHTMLHeaders et setTXTHeaders fonctions, mais il semble qu'il n'y a rien de ce genre. Ai-je raté quelque chose? Comment puis-je mettre les deux-têtes Content-Type UTF-8?

source d'informationauteur Lorenzo Marcon | 2012-10-08