创建 HTML 电子邮件时的规则?

发布于 2024-09-28 02:44:25 字数 117 浏览 4 评论 0原文

创建 HTML 电子邮件时有什么需要注意的吗?是不是像创建一个有效的 HTML 页面然后通过 PHP 发送它一样简单?或者我是否需要使用表格来确保它正确显示。

任何能在第一次就做到这一点的建议将不胜感激。

Is there anything I need to be aware of when creating a HTML e-mail? Is it as simple as creating a valid HTML page then sending it via PHP? Or do I need to use tables to ensure it display's correctly.

Any advice to get this right first time would be much appreciated.

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

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

发布评论

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

评论(4

假装不在乎 2024-10-05 02:44:25

创建在电子邮件客户端中以您想要的方式显示的 HTML 电子邮件即使不是不可能,也可能非常困难。不幸的是,电子邮件客户端在显示电子邮件时不使用最新和最好的网络浏览器,并且它们还可以限制应该允许的内容(并且有充分的理由)。

无论您多么喜欢基于 CSS 的布局,基于表格的布局仍然是 HTML 电子邮件的最佳选择。当然,您仍然可以将 CSS 用于其他用途,但在某些情况下,它需要内联。我见过的最好看的 HTML 电子邮件主要由表格和大图像组成 - 仅仅是因为与普通网页不同,使用良好的 Web 开发实践几乎不可能创建等效的内容。 HTML 电子邮件有其自己的世界。

您还应该在尽可能多的电子邮件客户端中测试电子邮件 - 虽然安装所有不同的客户端可能很麻烦,但您也可以使用诸如 LitmusMailChimpCampaignMonitor(另请参阅此问题)。就我个人而言,我在 Litmus 方面有过很好的经历。

祝你好运,创建 HTML 电子邮件可能会非常混乱!

Creating an HTML email that displays the way you want to in email clients, can be very difficult, if not impossible. Unfortunately, email clients do not use the latest and greatest web browsers when displaying emails, and they can also restrict what should be allowed (and with good reasons).

No matter how much you might love CSS-based layouts, table-based layout is still the way to go for HTML emails. You can still use CSS for other things, of course, but in some cases it will need to be inline. The best looking HTML emails I've seen, are largely made up of tables and big images - simply because unlike on normal web pages it is nigh on impossible to create the equivalent using good web development practices. HTML email is a world of its own.

You should also test the emails in as many email clients as you can - and while it can be cumbersome to install all the different clients, you can also use services such as Litmus, MailChimp and CampaignMonitor (see also this question). Personally I have had good experiences with Litmus.

Good luck, creating HTML emails can be quite messy!

眼眸 2024-10-05 02:44:25

表格绝对是 HTML 电子邮件的最佳选择,因为大多数其他方法往往在不同的计算机上显示不同。

需要注意的事项:

  • 图像经常被电子邮件程序阻止 - 尽可能尝试使用背景颜色
  • 不要链接到外部样式表 - 将样式放在 中。这将防止您的服务器在打开电子邮件时受到攻击。

还有来自 Mailchimp 的不错的博客文章关于在 HTML 电子邮件中使用 CSS。

Tables are definitely the best option for HTML emails, since most other methods tend to display differently on different machines.

Things to watch out for:

  • Images are often blocked by email programmes - try to use background colours where possible
  • Don't link to an external stylesheet - put the styles in <head>. This will prevent your server being hit when the emails are opened.

There's also a good blog post from Mailchimp about using CSS in HTML emails.

盗梦空间 2024-10-05 02:44:25

表格很糟糕...但是发送电子邮件的正确方法...
还只发送您通常放入正文中的部分,并且仅使用内联 css。
另一件重要的事情是背景图像大多数时候不起作用。

这是一个非常好的指南,可以帮助您。

我的建议:在很多浏览器、邮件客户端和电子邮件程序中进行测试

Tables is bad...but the correct way to go in emails...
Also send only the part you would normally put in the body and only use inline css.
Another important thing is that background images most of the time dont work.

This is a very good guide that can help you out.

my advice: test in a lot of browsers,mailclients and email programs

秋叶绚丽 2024-10-05 02:44:25

您应该查看 Acid 上的电子邮件,他们不仅会向您展示您的电子邮件在每个客户中的外观,而且还会对其进行分析你的 HTML。它们会突出显示代码中客户端不支持的 HTML。这个工具帮我节省了很多时间来尝试找出电子邮件无法正确呈现的原因。

另一件非常有帮助的事情是他们提供提示和信息。适合每个客户的技巧。无论如何,您可能想检查一下,非常有帮助。

You should check out Email on Acid, they not only show you what your email will look like in each client they also analyze your HTML. They highlight the HTML in you code that is not supported in the clients. This tool has saved me hours trying to figure out why an email doesn't render correctly.

One other thing that is very helpful is they provide Tips & Tricks for each client. Anyway you might want to check it out, very helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文