如何添加在电子邮件正文中的图像 [英] How to add an image in email body

查看:179
本文介绍了如何添加在电子邮件正文中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要添加图像的电子邮件正文。 我不想图像附加到电子邮件,但在邮件主体添加一个图像。

I want to add an image in email body. I don't want to attach an image to the email, but add an image in the email body.

如何做到这一点?

我用这个。

"<img src=\"data:image/png;base64,"+convertFileTOByteEncrypt()+"\">"

  "<img src=\"http://images.anandtech.com/doci/3982/HTCSurround-0134.jpg\">"

然后图像显示是这样的。

Then image is displayed like this.

推荐答案

不幸的是,它不可能与意图做到这一点。

Unfortunately, it's not possible to do this with Intents.

为什么例如粗体文本显示在EditText上,而不是一个图像的原因是 StyleSplan 正在实施 Parcelable 而的 ImageSpan 没有。因此,当Intent.EXTRA_TEXT检索在新的活动的ImageSpan将无法unparcel并为此不追加到的EditText样式的一部分。

The reason why for example bold text is displayed in the EditText and not an Image is that StyleSplan is implementing Parcelable whereas ImageSpan does not. So when the Intent.EXTRA_TEXT is retrieved in the new Activity the ImageSpan will fail to unparcel and therefor not be part of the style appended to the EditText.

使用其他方法,你不传递数据的意图是不幸的是没有可能在这里,你是不是在接收活动的控制。

Using other methods where you don't pass the data with the Intent is unfortunately not possible here as you're not in control of the receiving Activity.

这篇关于如何添加在电子邮件正文中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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