Hello,
I'm using PEAR to send HTML emails from my website. My email are sent, but they are not formatted according to the CSS when viewed in Hotmail/Yahoo/GMail. When I view them in Windows Live MAil, they look great.
To be more specific, it seems as if non of the CSS is taken into consideration (text format, background images etc.).
Here's the code I use to send the email:
$headers = array('From' => $from, 'Subject' => $subject, 'To' => $to);
require_once 'Mail.php';
require_once 'Mail/mime.php';
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($plainText);
$mime->setHTMLBody($htmlText);
$body = $mime->get();
$headers = $mime->headers($headers);
$mail = Mail::factory("mail");
$send = $mail->send($to, $headers, $body);
if (PEAR::isError($send)) {
$mail_sent = 0;
}else {
$mail_sent = 1;
}
Should I include Content-Type in the header? I've tried but it didn't help.
$htmlText is a variable containing my html. The style is embeded into the HTML (not linked to a CSS file).
If anyone can let me know why my email is not formatted in the web clients, I would be gratefull.
Thanks a lot,
Ziv