在电子邮件正文中应用HTML格式

栏目: Html · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/1934130/applying-html-formatting-in-emails-body
我仍然想弄清楚,为什么我不能在自定义电子邮件的正文中应用 HTML

格式.我确信我错过了一些东西,或者我需要一双新的眼睛!

以下是添加到<head>的信息的网页

<head runat="server">
    <link href="~/MyStyle.css" rel="stylesheet" type="text/css" />
</head>

Mystyle.css包含以下内容

span.orange
{
    color: #FF6D06;
    font-family: tahoma;
    font-size: 10pt;
}

这是身体的一部分……

Dim HtmlString as string = "<span class='orange'>This one should be painted</span>"

这是使用Net.Mail发送的

Dim objMail As New Mail.MailMessage (blah, blah blah)
objMail.IsBodyHtml = True

更新:首先感谢您的意见.电子邮件本身不以任何方式以样式表引用.那么除了将样式表附加到电子邮件之外,我还有哪些选项?

当我这样做时,我通常将CSS嵌入到电子邮件的正文中:
<html>
<head>
<style type="text/css">
span.orange
{
    color: #FF6D06;
    ...
}
</style>
</head>
...

避免在HTML电子邮件中引用外部实体(如样式表,图像等).这些引用可能不可用,具体取决于用户的邮件代理设置.另外,了解邮件代理中的HTML支持.它可能没有你想象的那么丰富.例如 Here’s some information on Outlook .

翻译自:https://stackoverflow.com/questions/1934130/applying-html-formatting-in-emails-body


以上所述就是小编给大家介绍的《在电子邮件正文中应用HTML格式》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head First Design Patterns

Head First Design Patterns

Elisabeth Freeman、Eric Freeman、Bert Bates、Kathy Sierra、Elisabeth Robson / O'Reilly Media / 2004-11-1 / USD 49.99

You're not alone. At any given moment, somewhere in the world someone struggles with the same software design problems you have. You know you don't want to reinvent the wheel (or worse, a flat tire),......一起来看看 《Head First Design Patterns》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试