发送电子邮件客户端兼容的电子邮件
我们的电子邮件可以通过各种不同的方式进行品牌标记,但仍然包含相同的内容。 因此,我需要能够发送包含 CSS 样式但仍与大多数电子邮件客户端兼容的 HTML 电子邮件。 我遇到过以下网站,其中详细介绍了电子邮件客户端的兼容性:
上述大多数客户端似乎不支持元素中指定的 CSS 样式,但它们确实支持内联 css。 我希望将电子邮件的品牌分离到单独的 css 文件中,然后在运行时内联合并样式。 这可能吗? 如果没有,还有其他选择吗?
We have emails that can be branded in a varierty of different ways but still contain the same content. Therefore, I need to be able to send HTML emails that contain CSS styling but are still compatible with the majority of email clients. I've come across the following websites that detail the compatibility of email clients:
Most of the above clients don't seem support CSS styles specified in the element but they do support inline css. I wish to separate the branding of the emails into separate css files and then combine the styles inline at runtime. Is this possible? If not, are there any alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们最近整合了一个可能满足您需求的模板系统。 基本上,我们为将要发送的所有电子邮件创建了 HTML 和纯文本版本。 在每个模板中,我们都有令牌,这些令牌在运行时会替换为特定于收件人的信息。 我们的模板有代表名称、url 等的标记,但 css 引用没有理由不能被替换。
另请注意,如果您希望您的电子邮件与所有电子邮件客户端兼容,您确实需要发送纯文本和 HTML 版本的电子邮件。 这是使用 .NET 中的替代视图来完成的。 您可以了解有关电子邮件、链接资源的更多信息、替代视图和电子邮件例外情况位于此处。
We recently put together a templating system which might meet your need. Basically we created both HTML and Plain-Text versions of all emails which will be delivered. Inside each template we have tokens which are replaced at runtime with recipient-specific information. Our templates have tokens which represent names, urls, etc, but there's no reason why css references couldn't be replaced as well.
Another note, if you want your emails to be compatible with all email clients, you really need to send both plain-text along with HTML versions of the email. This is done using Alternative Views in .NET. You can read more about emailing, linked resources, alternative views and email exceptions here.
您发送的电子邮件包含什么内容? 当您生成电子邮件时,任何编程语言都应该可以组合您的 CSS 文件并将它们写入电子邮件内容中。
但这取决于您使用什么来发送电子邮件。
What are you sending the email with? It should be possible with any programming language to combine your CSS files and write them into the email content when you are generating the email.
But it depends on what you are using to send the emails.