简体   繁体   English

GMail 不标记电子邮件 html(通过 PHP 发送)

[英]GMail doesn't mark up email html (sending via PHP)

I am trying to send a html email via mail(), however gmail just displays the email as plain text, no mark up, eg:我正在尝试通过 mail() 发送 html 电子邮件,但是 gmail 只是将电子邮件显示为纯文本,没有标记,例如:

mail("blah@blah.com", "<i>Italic Text</i>");

just appears as只是显示为

<i>Italic Text</i>

Any ideas?有任何想法吗?

Have you set your email headers?您是否设置了电子邮件标题?

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

If yes, do any other email clients have the same problem?如果是,是否有其他电子邮件客户端有同样的问题? Or is it just Gmail?还是只是 Gmail?

Try it with css, the i tag is deprecated, not sure if that is causing it...用 css 尝试一下,不推荐使用i标签,不确定这是否是导致它...

<span style='font-style:italic;'>Italic Text</span>

Or you could try using the em tag:或者你可以尝试使用 em 标签:

<em>Italic Text</em>
. .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM