简体   繁体   English

如何创建HTML电子邮件模板?

[英]How to create a HTML e-mail template?

Earlier I posted here a question about how to get two tables responsive. 之前我在这里发布一个有关如何使两个表响应的问题。 First they replied that I should not use <table> instead of <div> , but later on they said I need to use the old style <table> , because it will be an e-mail template. 首先,他们回答说我不应该使用<table>而不是<div> ,但是后来他们说我需要使用旧样式<table> ,因为它将是一个电子邮件模板。

After all I am converting the header to the old style in tables, and as a result it looks pretty good in the browser, but after sending it via the e-mail it is completely messed up again (except on my phone). 毕竟,我将表头转换为表格中的旧样式,结果在浏览器中看起来还不错,但是通过电子邮件发送后,头又被完全弄乱了(手机上除外)。 Now I am using the old style, but still it doesn't work. 现在我正在使用旧样式,但仍然无法正常工作。 What could be the problem here? 这可能是什么问题?

UPDATED: 更新:

Two full days I tried to create my own e-mail template in HTML. 我整整两天试图用HTML创建自己的电子邮件模板。 Included this one I have read many posts about this topic. 包括这一篇,我已经阅读了许多有关该主题的文章。 What I have experienced as a fullstack developer is that e-mail development is completely a different way of programming. 作为一个全栈开发人员,我所经历的是电子邮件开发完全是一种不同的编程方式。 If you want to create your own e-mail template in HTML, please read this before. 如果要使用HTML创建自己的电子邮件模板,请先阅读此内容

What @Gwally and I would advise is to use Zurb Foundation which is a responsive front-end framework who will help you to create an e-mail template in a easy way. 我建议@Gwally使用Zurb Foundation ,它是一个响应迅速的前端框架,它将帮助您以简单的方式创建电子邮件模板。 After when you are ready, you should test your e-mail template with Litmus . 准备就绪后,您应该使用Litmus测试您的电子邮件模板。

In short; 简而言之; creating your own e-mail template in HTML is pretty hard. 用HTML创建自己的电子邮件模板非常困难。 It takes a lot of time and after all you don't know the e-mail template is going to work for almost all the e-mail clients. 这会花费很多时间,而且毕竟您不知道电子邮件模板几乎可以用于所有电子邮件客户端。 I started over with Zurb Foundation and it works pretty good ;) 我从Zurb Foundation开始,它运作良好;)

Good luck! 祝好运!

There are plenty of places to find modern HTML templates to use as a base for your Email projects. 有很多地方可以找到现代HTML模板用作您的Email项目的基础。 There's been plenty of advice posted here in Stack Overflow to help people with their projects. 在Stack Overflow上有很多建议可以帮助人们进行项目。 It's important to remember that email development is not web development. 重要的是要记住,电子邮件开发不是Web开发。 The two are based on HTML, but they use it in different forms. 两者基于HTML,但是它们以不同的形式使用。 Here's a few things that can get you on the way. 以下是一些可以帮助您的方法。

What works 什么有效

Campaign Monitor has an excellent guide on what works in email with email clients. Campaign Monitor对于如何与电子邮件客户端一起使用电子邮件提供了很好的指导。

Working modern templates 工作现代模板

The best way to learn is to look at what others have done and emulate it for your own needs. 最好的学习方法是查看他人所做的事情,并根据自己的需要进行模仿。 I'm a personal fan of Zurb Foundation. 我是Zurb Foundation的个人粉丝。 I have used version 1.0 for one-offs and find 2.0 to be valuable for fixing some of the issues that come from email development, such as template consistency. 我曾经一次性使用1.0版,发现2.0版对于解决某些来自电子邮件开发的问题(例如模板一致性)非常有用。

Ask questions & read answers 提出问题并阅读答案

One of the best resources for email development is where you are right now here in Stack Overflow. 电子邮件开发的最佳资源之一是Stack Overflow中的当前位置。 There's a few dedicated experts who have helped the community with really good solutions to questions. 有一些专门的专家帮助社区提供了非常好的问题解答。

Good luck. 祝好运。

Based on CSS classes in email , you should use inline styles to maintain your layout in the email. 基于电子邮件中的CSS类 ,您应该使用内联样式来维护电子邮件中的布局。

You can take a look this article for some suggestions as to how you can get a responsive layout in your emails. 您可以查看本文,以获取有关如何在电子邮件中获得响应式布局的一些建议。 https://css-tricks.com/ideas-behind-responsive-emails/ but you need to approach them differently from web pages. https://css-tricks.com/ideas-behind-sensitive-emails/,但是您需要采用不同于网页的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM