发送 html/图像电子邮件的最佳方式是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the best way to send html/image email?
提问by mk.
Do you attach the images?
你附上图片吗?
Use absolute urls?
使用绝对网址?
How do you best avoid getting flagged as spam?
您如何最好地避免被标记为垃圾邮件?
回答by Ian
One of the biggest causes, that I have found, for email to be flagged as spam is DNS. Make sure the domain / MX records from which you are sending the email actually resolve correctly back from the server used for sending.
我发现,电子邮件被标记为垃圾邮件的最大原因之一是 DNS。确保您发送电子邮件的域/MX 记录实际上从用于发送的服务器正确解析。
As for images, you could attach them, but the most common way is to host them and use absolute urls. Primarily this is a bandwidth issue - you have to figure you're going to get an open rate of 10 - 15%: if you have to attach all the assets to every email, 85% of the bandwidth you'll use will be wasted.
至于图像,您可以附加它们,但最常见的方法是托管它们并使用绝对 url。这主要是一个带宽问题 - 您必须确定您将获得 10 - 15% 的打开率:如果您必须将所有资产附加到每封电子邮件,那么您将使用的 85% 的带宽将被浪费.
回答by EndangeredMassa
You attach the emails then reference them in your HTML like so:
您附加电子邮件,然后在您的 HTML 中引用它们,如下所示:
<img src="cid:imagefilename.jpg" />
Outlook, at least, recognizes this as a reference to an attached image and dumps it in appropriately.
至少,Outlook 将此识别为对附加图像的引用,并适当地将其转储。
回答by Bryan M.
You'll want to use absolute URLs to link out to images on a server. Users won't want to download your attachments. Also most email clients will not displays images by default, so it's a good idea to keep the really important content as text.
您需要使用绝对 URL 链接到服务器上的图像。用户不会想要下载您的附件。此外,大多数电子邮件客户端默认不会显示图像,因此最好将真正重要的内容保留为文本。
Email clients generally all use very different rendering methods. For example, Outlook 2007 uses Word's HTML rendering engine, whereas previous versions used Internet Explorer.
电子邮件客户端通常都使用非常不同的呈现方法。例如,Outlook 2007 使用 Word 的 HTML 呈现引擎,而以前的版本使用 Internet Explorer。
Do be aware that CSS support is also very limited to in emails. Most clients, especially web mail, will strip out everything outside of the <body> tag, as well as <style> tags. This means that external or embedded CSS will not work, and that inline styles are the safest bet (the style="" attribute). There is also poor support for many CSS rules in Outlook 2007. This means that a lot people have returned to using tables for laying out email.
请注意,CSS 支持也仅限于电子邮件。大多数客户端,尤其是 Web 邮件,会去除 <body> 标签和 <style> 标签之外的所有内容。这意味着外部或嵌入式 CSS 将不起作用,内联样式是最安全的选择(style="" 属性)。Outlook 2007 中对许多 CSS 规则的支持也很差。这意味着很多人已经重新使用表格来布置电子邮件。
As it was pointed out, Campaign Monitor is an excellent resource, and I especially recommend their CSS Compatibility Chart
正如有人指出的,Campaign Monitor 是一个很好的资源,我特别推荐他们的CSS Compatibility Chart
回答by Grégtheitroade Cachet
Campaign Monitor is a great resources for html email: http://www.campaignmonitor.com/resources/#building
Campaign Monitor 是 html 电子邮件的绝佳资源:http: //www.campaignmonitor.com/resources/#building
Also http://www.email-standards.org/, but seems down right now.
还有http://www.email-standards.org/,但现在似乎没落。