问题描述
是否可以将图像编程嵌入到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 标签。如果您不想使用网络服务器托管图像,则可以使用图像的数据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.
:
如果要将图像附加到电子邮件中,可以使用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中的电子邮件中嵌入图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!