Embedding image in email in Android

前端 未结 2 483
[愿得一人]
[愿得一人] 2020-12-04 00:12

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

Can I use the ACTION_SEND intent to do this, or should I c

2条回答
  •  一整个雨季
    2020-12-04 00:39

    If your image (or file) is in the SD card, you can proceed as follow:

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/your_path_in_the_sd_card/your_image.png"));
    startActivity(shareIntent);
    

    If you don't want to send image, you need to modify the MIME in the "setType()" method.

    For more details check this post.

提交回复
热议问题