Send Mail with Image

How to send the image to the mail in android for these you can refer the following code
Getting image from Web

InputStream is = (InputStream) new URL("Image URL").getContent();
// storing image from stream
Drawable drawable = Drawable.createFromStream(is, "srcName");
is.close();
// converting drawable object to Bitmap to store in content providers of Media
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
// Store image in Devise database to send image to mail
String path = Images.Media.insertImage(getContentResolver(), bitmap,"title", null);
Uri screenshotUri = Uri.parse(path);
final Intent emailIntent1 = new Intent( android.content.Intent.ACTION_SEND);
emailIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent1.setType("plain/text");
emailIntent1.putExtra(android.content.Intent.EXTRA_SUBJECT,CouponActivate.this.getResources().getString(R.string.facebookstatus));
emailIntent1.putExtra(android.content.Intent.EXTRA_TEXT,"Enter the Text");
emailIntent1.putExtra(android.content.Intent.EXTRA_TITLE,"Title";
emailIntent1.putExtra(Intent.EXTRA_STREAM, screenshotUri);
emailIntent1.setType("image/png");
startActivity(Intent.createChooser(emailIntent1, "Send email using"));


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at info@nanostuffs.com, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box