HTML格式的电子邮件不会在Gmail中显示,而是在其他邮件客户端中显示 [英] HTML formatted email not showing up at all in Gmail but is in other mail clients

查看:232
本文介绍了HTML格式的电子邮件不会在Gmail中显示,而是在其他邮件客户端中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前从PHP的mail()函数发送html格式的电子邮件,并检查他们只是为了确保他们显示为HTML(格式化,我知道,格式化将不同(可能是巨大的)从客户端到客户端)。他们在Apple Mail客户端以及我的iPhone上显示为HTML。但是,Gmail只是拒绝将其显示为HTML。而且我不是说它的格式不正确,它只是简单地不使用HTML它出现。

I'm currently sending html formatted emails from PHP's mail() function and checking them simply to make sure they are showing up as HTML (formatting aside, I'm well aware that the formatting will vary (probably drastically) from client to client). They are displaying as HTML in the Apple Mail client as well as on my iPhone. However, Gmail simply refuses to display it as HTML as all. And by that I don't mean it is formatted incorrectly, it just simply isn't using HTML it appears.

奇怪的部分是从标签的img正在加载,但这是关于它...是的,我大多使用div的布局,这是新的Gmail或某事(vs表)?

The weird part is that an img from a tag is being loaded, but that's about it... is it that I'm mostly using divs for layout and that's too new for Gmail or something (vs tables)?

就像CSS一样,查看原始来源显示以下内容:

As far as CSS and what not goes, viewing the raw source shows the following:

<html><head><style>body { background-color: #F2F2F2; font-family: Arial; color: #5C5C5C; font-size: 11pt; } a { color: #46AAFF; text-decoration: none; } #container { width: 750px; margin-right: auto; margin-left: auto; } #header { float: right; padding: 3px; height: 30px; } #header a { color: #666666; margin-right: 10px; } #mainBody { padding: 20px; background-color: #FFF; border: 1px solid #DADADA; border-radius: 3px; } #imageArea { border-top: solid #E8E8E8 1px; margin: 15px; } #singleImageArea { width: 250px; padding: 15px; } #singleImageArea p { float: right; line-height: 30px; width: 130px; margin-top: 20px; } #footer { padding: 10px; color: gray; } #footer p { text-shadow: 0px 2px #FFF; font-size: 10pt; } #footer a { color: #ADADAD; float: right; padding-left: 20px; padding-right: 20px; } #footer img { width: 35px; height: 23px; padding: 10px; float: left; } </style></head><body><div id="container"><div id="header"><a href="http://appname.local/login/">Login</a></d
 iv><div style="clear: both;"></div><div id="mainBody"><h1>Hi Josh Holat!</h1>You've sent a request to <strong>reset</strong> your appname password. Just click the link below <em>(or copy and paste it into your browser)</em> and follow the instructions to set a new password. The link will expire in one hour.<br/><br/><a href="http://appname.local/sb/reset-password/?r=2768af61698fcde9c04f9449351575d6bfe6d720">http://appname.local/sb/reset-password/?r=2768af61698fcde9c04f9449351575d6bfe6d720</a><br/><br/>If you feel this request was submitted in error, don't worry; you can safely ignore this e-mail and your password will not be changed.<br/><br/>Much Love,<br/>Us</div><!-- #mainBody --><div id="footer"><img src="http://appname.local/images/email/footer_sb.png" /><p>&copy; 2011 appname, Inc. All Rights Reserved <a href="http://appname.local/sb/legal/">Legal</a><a href="http://appname.local/sb/contact/">Contact</a><a href="http://s
 tagebloc.local/sb/developers/">Developers</a><a href="http://appname.local/sb/blog/">Blog</a></p></div><!-- #footer --></div><!-- #container --></body></html>

以及:

    Delivered-To: appname@gmail.com
Received: by 10.229.40.2 with SMTP id i2cs133298qce;
        Sun, 28 Aug 2011 14:29:08 -0700 (PDT)
Received: by 10.42.152.199 with SMTP id j7mr4419937icw.417.1314566947950;
        Sun, 28 Aug 2011 14:29:07 -0700 (PDT)
Return-Path: <_www@joshholat.local>
Received: from joshholat.local (arh2281.urh.uiuc.edu [130.126.70.193])
        by mx.google.com with ESMTP id w3si6800550icz.109.2011.08.28.14.29.06;
        Sun, 28 Aug 2011 14:29:06 -0700 (PDT)
Received-SPF: neutral (google.com: 130.126.70.193 is neither permitted nor denied by best guess record for domain of _www@joshholat.local) client-ip=130.126.70.193;
Authentication-Results: mx.google.com; spf=neutral (google.com: 130.126.70.193 is neither permitted nor denied by best guess record for domain of _www@joshholat.local) smtp.mail=_www@joshholat.local
Received: by joshholat.local (Postfix, from userid 70)
    id 775063662E01; Sun, 28 Aug 2011 16:29:06 -0500 (CDT)
To: Josh Holat <appname@gmail.com>
Subject: Password Reset Request
X-PHP-Originating-Script: 501:Email.php
From: appname <noreply@appname.com>
Content-type: text/html
Message-Id: <20110828212906.775063662E01@joshholat.local>
Date: Sun, 28 Aug 2011 16:29:06 -0500 (CDT)

我不明白为什么第三方客户会显示正常,但Gmail会忽略它?

I'm confused as to why third party clients would show it fine but Gmail simply ignore it?

推荐答案

Gmail不支持< style> 标记。您需要使用内联css为gmail正常工作。

Gmail does not support the <style> tag. You need to use inline css for gmail to work correctly.

这是一个参考列表。
http://www.campaignmonitor.com/css/

Here's a reference list. http://www.campaignmonitor.com/css/

这篇关于HTML格式的电子邮件不会在Gmail中显示,而是在其他邮件客户端中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆