我试图在Phalcon上用PHPMailer发送一些html邮件。 我到达发送它们但是当我在我的邮箱(outlook或gmail)上打开邮件时,它没有考虑到与html邮件关联的CSS。但是当我在Thunderbird上打开它时,它考虑到了css。所以我不明白为什么邮箱不能读取css风格。
这是邮件:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title id="titre">Mail Gagnant</title>
<style id="style">
body{
background-color:#d41d1d;
overflow:hidden;
background-image:url(/jeux/346/mailgagnants_background_mail);
}
#header{
max-width:100%;
height:auto;
}
#footer{
max-width:100 %;
height:auto;
}
</style>
</head>
<body>
<img id="header" src="/jeux/346/mail/gagnants_header_mail" alt="header">
<div id="body">
<div id="content">
<b>Bonjour </b>
<font face="Times New Roman">je suis un test</font>
<br>
</div>
</div>
<img id="footer" src="/jeux/346/mail/gagnants_footer_mail" alt="footer">
</body>
</html>
通过此代码生成:
$this->mail->From = "------@-------.---";
$this->mail->FromName = "----";
$this->mail->SMTPDebug = 0;
$this->mail->addAddress($dest);
$this->mail->Subject = $mail->objet;
$this->mail->Body=file_get_contents($jeu->directory."mail/$type_mail.phtml");
$this->mail->AltBody='La boite mail n est pas compatible avec les mails HTML';
$this->mail->IsHTML(true);
$this->mail->send();
PHPMailer参数是这样的:
'mail' => array(
'smtp' => array(
'server' => 'my server',
'port' =>myport ,
'security' => 'tls',
'username'=> 'username',
'password' => 'pwd'
)
)