gpt4 book ai didi

html - 如何检测是否在 Outlook 2007 或 2010 中打开了 HTML 电子邮件?

转载 作者:行者123 更新时间:2023-11-28 02:14:14 25 4
gpt4 key购买 nike

我目前正在尝试为我工作的公司撰写时事通讯。时事通讯在所有主要互联网浏览器(IE 5.55 到 9、Chrome、Firefox、Opera)中都能正确显示,但是当任何人在 Outlook 2007 或 2010 中打开它时,所有字体看起来都“变大了”。

我知道这个问题是因为 Outlook 像 Word 一样呈现 HTML 的方式,如果我手动“缩小”字体,它们在 Outlook 中看起来不错,但在任何其他电子邮件软件中都不是。

我的问题是这样的。有没有办法检测电子邮件是否在 Outlook 甚至 Word 中打开?鉴于 Outlook 不允许 JavaScript,此解决方案必须采用纯 HTML 格式。我的计划是检测电子邮件浏览器并动态更改字体(一种 if-else)。

感谢您的帮助!

最佳答案

条件注释

使用条件注释也许可以实现这一点。

<!--[if mso ]>      ...<![endif]-->    <!-- Outlook -->
<!--[if gte mso 12]>...<![endif]--> <!-- Outlook 2007+ -->
<!--[if gte mso 14]>...<![endif]--> <!-- Outlook 2010+ -->
<!--[if gte mso 15]>...<![endif]--> <!-- Outlook 2013+ -->
<!--[if !mso ]> ...<![endif]--> <!-- Not Outlook -->

由于 Outlook 支持头部或正文中的 style 标记,因此可以执行以下操作:

<!--[if gte mso 12]>
<style type="text/css">
.myClass {
/* Special styling for Outlook 2007 and later */
}
</style>
<![endif]-->

在 Outlook 2007/2010/2013 中使用条件注释在 Litmus 上测试良好。

关于html - 如何检测是否在 Outlook 2007 或 2010 中打开了 HTML 电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6189685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com