[PEAR][Mail] Mail au format HTML
Bonjour à tous :P
je ne comprends rien. Mon mail en format html est bizarre.
Voici le code
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
include ("Mail.php");
include("Mail/mime.php");
$crlf = '\n';
$from = "<contact@monserveur.com>";
$to = $email;
$subject = $obj;
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$htmlBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
$htmlBody .= "<HTML><BODY>";
$htmlBody .= "Bonjour,<br />";
$htmlBody .= "<br />";
$htmlBody .= "blabla";
$htmlBody .= "<br />";
$htmlBody .= "blabla";
$htmlBody .= "<br />";
$htmlBody .= "<br />";
$htmlBody .= "Cordialement.";
$htmlBody .= "------------------------------------------------------------------------------";
$htmlBody .= "</BODY></HTML>";
$txtBody = "Bonjour,\n";
$txtBody .= "\n";
$txtBody .= "blabla";
$txtBody .= "\n";
$txtBody .= "blabla";
$txtBody .= "\n";
$txtBody .= "\n";
$txtBody .= "Cordialement.\n";
$txtBody .= "PS : Cet e-mail provient d'un envoi automatisé.\n";
$txtBody .= "------------------------------------------------------------------------------";
$mime = new Mail_Mime($crlf);
$mime->setHTMLBody($htmlBody);
//$mime->setTXTBody($txtBody);
$body = $mime->get();
$headers = $mime->headers($headers);
$host = "localhost";
$auth =false;
$send = Mail::factory('smtp',
array ('host' => $host,
'auth' => $auth));
$mail = $send->send($to, $headers, $body); |
et j'obtiens ceci:
Code:
1 2 3 4 5 6 7
|
B=onjour,
blabla
blabla
Cordialement.-------------=----------------------------------------------------------------- |
si je décommente $mime->setTXTBody($txtBody);
c'est encore pire!!!
Quelqu'un pourrait m'aider à:
- savoir pourquoi ce caractère '=' apparait?
- comment envoyer un mail en format HTML avec table, div, p, br, etcetera?
un tuto quelque part?
désolée:oops:
et merci beaucoup:zoubi: