在Android中嵌入图像的电子邮件 [英] Embedding image in email in Android

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

问题描述

是否有可能以编程方式嵌入图像在Android上的邮件应用程序发送的电子邮件的正文?

Is it possible to programatically embed an image in the body of an email sent by the Mail app in Android?

我可以使用ACTION_SEND故意这样做,或者我应该撰写邮件我?

Can I use the ACTION_SEND intent to do this, or should I compose the email myself?

推荐答案

把图像中的身体,你需要设置内容类型为text / html的,然后把一个 IMG 标签在电子邮件正文中。如果你不想使用Web服务器来承载图像,那么你可以使用一个数据的URI的形象。

to put the image in the body, you need to set the content type to "text/html" and then put an img tag in the email body. if you don't want to use a webserver to host the image, then you can use a data uri for the image.

信息和放大器;样品

<img src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Red dot" />

如果您希望将图像附加到电子邮件,使用putExtra方法,并将其设置为EXTRA_STREAM。

If you want to attach an image to the email, you use the putExtra method and set it to EXTRA_STREAM.

emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, myImageStream);

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

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