What Are The Possible Ways To Send Image Via Email In Android?
I am using the following code to send html format to send email in Android; now I want to send Image with it. private void friends_email_share() { Log.i('Send email', '');
Solution 1:
This might help you..
try{
finalIntentemailIntent=newIntent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,newString[] { "android@abcxyz.com" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Emergency");
emailIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://"+ path + "/" + image_name));
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Please Find Attachments");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
} catch (Throwable t) {
Toast.makeText(MainActivity.this, "Request failed: " + t.toString(),Toast.LENGTH_LONG).show();
}
}
Solution 2:
You can find the answer here.
About your question, you can add the image in the assets folder as an attachment like this:
IntentemailIntent=newIntent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "Text text");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"This is email subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is extra text");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///android_asset/allimages/demoImage.jpg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Hope this helps.
Post a Comment for "What Are The Possible Ways To Send Image Via Email In Android?"