我可以使用div和嵌入式样式表发送带有图像的电子邮件吗? [英] Can I Send an Email with image using div and embedded style sheet?

查看:134
本文介绍了我可以使用div和嵌入式样式表发送带有图像的电子邮件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下html,嵌入式css发送html电子邮件。该电子邮件包含一个图像,借助嵌入式css样式显示div元素。我无法在电子邮件客户端中看到图像。请参考以下链接到我的html和css代码。

http://codepen.io / anon / pen / mJxvPp?editors = 100 [ ^ ]

i used the following html, embedded css to send a html email. That email contains an image to be displayed with div element with help of embedded css style. I can't able to see image in the email client. Please refer below link to my html and css code.
http://codepen.io/anon/pen/mJxvPp?editors=100[^]

推荐答案

您需要对整个电子邮件或其某些部分使用内容类型text / html 如果是多部分电子邮件。 CSS可以像支持HTML一样完全嵌入。



嵌入图像更加棘手。您需要创建一个多部分电子邮件。比方说,一部分是图像,它具有内容 - 处置而不是内联(附件)。它的内容类型可以是image / png或任何其他图像内容类型,具体取决于它的实际内容。现在,您需要在HTML部分中引用此图像。这是使用特殊的 URI sheme cid:完成的。



请查看我过去的答案:

发送带图片的HTML附件 [ ^ ],

如何在smtp邮件实施中附加文件 [ ^ ],

我怎样才能在asp的电子邮件中发送带有文本的图像 [ ^ ]。



-SA
You will need to use content-type "text/html" for the whole e-mail or some of its parts in case of multi-part e-mail. CSS can be embedded exactly as in stand-along HTML.

Embedding an image is more tricky. You need to create a multi-part e-mail. Let's say, one part is the image, which has "Content-Disposition" other than inline ("attachment"). Its "Content-type" could be, say, "image/png" or any other image content type, depending on what it really is. Now, you need to reference this image in your HTML part. This is done using the special URI sheme "cid:".

Please see my past answers:
Sending HTML attachment with images[^],
How to attach a file in smtp mail implementation[^],
how can i send image with text in email in asp[^].

—SA


这篇关于我可以使用div和嵌入式样式表发送带有图像的电子邮件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆