I would like to send mail with attached image to the same address.
Asked
Active
Viewed 310 times
-1
-
please Do little bit surfing before ask the question.. this ans is available on stack http://stackoverflow.com/questions/9974987/how-to-send-an-email-with-a-file-attachment-in-android http://stackoverflow.com/questions/587917/trying-to-attach-a-file-from-sd-card-to-email – GovindRathod Aug 14 '14 at 09:07
-
@Concentrated_Attitude: Where do I put the email address of the sender please? – slama007 Aug 14 '14 at 09:31
2 Answers
1
use below code hope it will help you
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From My App");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));

Android is everything for me
- 3,781
- 4
- 28
- 37
-
-
why you want email address of sender when reciever recieves it he automatically gets sender address – Android is everything for me Aug 14 '14 at 09:37
-
cause your using intent to send email then when you call this code automatically default app of EMAIL will open and the account which is signed in in that email app will be your sender email address – Android is everything for me Aug 14 '14 at 09:38
-
you cannot mention sender email address you can mention receiver email address onlly – Android is everything for me Aug 14 '14 at 09:39
0
Check out the android development training for more information and examples Android Training
Intent emailIntent = new Intent(Intent.ACTION_SEND);
// The intent does not have a URI, so declare the "text/plain" MIME type
emailIntent.setType(HTTP.PLAIN_TEXT_TYPE);
emailIntent.putExtra(Intent.EXTRA_EMAIL,
new String[] {"jon@example.com"}); // recipients
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Email subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message text");
emailIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("content://path/to/emai/attachment"));
// You can also attach multiple items by passing an ArrayList of Uris
startActivity(emailIntent);

Afsa
- 2,025
- 1
- 16
- 19
-
-
You don't need to set the sender address. The e-mail application that receives the intent will set the sender address. – Afsa Aug 14 '14 at 13:39