Outlook 中的电子邮件 html 字体大小

发布于 2024-12-14 20:34:31 字数 465 浏览 4 评论 0原文

<div style="font-family: Arial; font-size: 10px;">TEST</div>

我将上述源代码作为 html 电子邮件提供给 Outlook 2007,它呈现 7.5px 字体。我需要什么技巧才能完成这项工作,有什么想法吗?

编辑:我正在使用 body 设置邮件内容,例如:

new MailMessage
{
    IsBodyHtml = true,
    Body = "<div style=\"font-family: Arial; font-size: 10px;\">TEST</div>"
};

但我不认为这是相关的。请注意,如果我查看生成的电子邮件中的源代码,则 html 符合预期。问题似乎只是 Outlook 出于某种原因无法正确呈现它。

<div style="font-family: Arial; font-size: 10px;">TEST</div>

I'm providing the above source as an html email to Outlook 2007, and it's rendering 7.5px font. Any ideas of what hack I need to make this work?

Edit: I'm setting the mail contents with body, like:

new MailMessage
{
    IsBodyHtml = true,
    Body = "<div style=\"font-family: Arial; font-size: 10px;\">TEST</div>"
};

I don't believe this is related though. Note that if I view source in the generated email the html is as expected. The problem seems to be only that outlook doesn't render it correctly for whatever reason.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最舍不得你 2024-12-21 20:34:31

问题是,大多数电子邮件程序对 CSS 的理解甚少(如果有的话)。尝试使用旧的非 CSS 方法指定字体详细信息。此方法已被弃用,但不幸的是,这是我们必须做的来设置电子邮件的样式。它还会阻止精确调整字体大小。

new MailMessage
{
    IsBodyHtml = true,
    Body = "<font face=\"Arial\" size=\"1\">TEST</font>"
};

The issue is that most email programs understand very little, if any, CSS. Try specifying the font details using the old, non-CSS methods. This method is deprecated, but unfortunately it is what we have to do to style the emails. It also prevents exact sizing of fonts.

new MailMessage
{
    IsBodyHtml = true,
    Body = "<font face=\"Arial\" size=\"1\">TEST</font>"
};
囍笑 2024-12-21 20:34:31

一些建议:

  • 创建 HTML 电子邮件时,使用 HTMLBody 属性而不是 Body
  • 你的引用需要这样转义吗?我以前从未见过这种情况,但我习惯了 VB,其中文字引号是双倍的。
  • 检查您的阅读设置,您可能正在以纯文本形式阅读电子邮件。

A few suggestions:

  • Use the HTMLBody property instead of Body when creating HTML emails.
  • Do your quotes need to be escaped like that? I've never seen that before, but I'm used to VB where literal quotes are doubled.
  • Check your read settings, you may be reading emails as plain text.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文