与在电子邮件签名中实现图像有关的一些问题?

Some questions related to implementation of image inside email signature?(与在电子邮件签名中实现图像有关的一些问题?)

本文介绍了与在电子邮件签名中实现图像有关的一些问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现带有图像的电子邮件签名.截至目前,我们仅支持电子邮件签名中已经工作的文本.我需要提供该功能我可以在邮件签名中插入图像.我可以将电子邮件发送给 myapplication 中的用户,也可以发送给外部邮件域(如 gmail、yahoo 等)上的用户.当邮件发送给我的应用程序系统中的某个用户,系统进入数据库,当接收者在收件箱中接收时(内部从数据库读取邮件).现在如果用户将邮件发送给 gmail 上的外部用户,它使用 javax 邮件 api.同样,我可以接收来自外部邮件域(gmail、yahoo 等)的电子邮件现在我有基于 tis 要求的几个问题:-

i need to implement the email signature with image.As of now we only support the text in email signature which is already working.i need to provide the functionality where i can insert the image inside mail signature. i can send the email to user within myapplication and also to user on external mail domain like gmail,yahoo etc. When mail is sent to some user with in my application system, system makes entryt o DB and when receiver receives in inbox (which internally read the mail from db). Now if user send the mail to external user on gmail it makes use of javax mail api . Similary i can receive the email from external mail domains(gmail,yahoo etc) Now i have few questions based on tis requirement:-

1) 对于像 gmail 这样的外部邮件域如何将签名内的图像发送到另一个域,比如(我的应用程序邮件域),是否有任何标准?与它相关的另一点 gmail 用户可以有两张图片,一张用于签名,另一张用于正文.我将如何确定哪个图像属于签名?是否有任何已定义的属性?

2) 也无法确定发送(无论是发送给内部应用程序用户还是外部邮件域用户)包含的电子邮件签名的最佳/一致方法是什么图像以便在用户接收时正确呈现?

我对第 2 点的想法:- 我之前认为我可以使用 如何在jsp中显示图片?.在哪里使用标签 <.img src="/getImage.action?imageId=123">,我可以从动作类或 servlet 中的 db 获取图像并返回.但请记住一旦我在 gmail 上将邮件发送给用户,他将无法访问 servlet.所以这种方法似乎不符合要求.然后我发现了另一个很棒的 stackoverflow 链接 base64 编码图像电子邮件签名Tim Medora 的解决方案看起来很棒,但 解决方案下方的评论 Gmail 似乎不支持它 再次结束了我的朋友真的我认为如果像gmail,yahoo这样的邮件域支持建议的解决方案,我应该这样做,因为在这种情况下,我可以将图像作为base64字符串发送图片作为附件.

what I had in my mind for point 2:- i earlier thought i can use solution suggested at How to display an image in jsp?. where with tag <.img src="/getImage.action?imageId=123">, i can fetch the image from db in action class or servlet and return. But keeping in mind once i send the mail to the user on gmail , he will not be able to access the servlet.So this approach does not seems to fit in requirement. Then i came across the another great stackoverflow link base64 encoded images in email signatures where solution by Tim Medora looked great but again the comment below the solution Gmail doesn't seem to support it again ended my Folks really i think i should be done if mail domain like gmail,yahoo support the solution suggested by because in that case i can send image as base64 string instead of image as attachment.

如果您能就第 1 点和第 2 点向我提供一些指导/方法,人们将不胜感激

Folks would be really grateful if you can provide me some pointer/approach regarding both points 1 and 2

推荐答案

要在电子邮件中包含图像,首先您必须将图像作为 MIME 附件包含在电子邮件中.这些附件中的每一个都必须有一个Content-ID"标头.

To include images in the email message, first you have to include the images as MIME attachments in the email. Each of these attachments must have a "Content-ID" header.

--f46d0444ea0d6991ba04b91c92e6
Content-Type: image/gif; name="theImage.gif"
Content-Transfer-Encoding: base64
Content-ID: <theImage@abcd>

[base64 string]
--f46d0444ea0d6991ba04b91c92e6--

2) 然后,在电子邮件消息中,将 Content-ID 包含在 <img> 标记的 src 属性中.

2) Then, in the email message, include the Content-ID in the src attribute of the <img> tag.

<img src="cid:theImage@abcd" />

这篇关于与在电子邮件签名中实现图像有关的一些问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:与在电子邮件签名中实现图像有关的一些问题?

基础教程推荐