-3

Possible Duplicate:
Android: How do I attach a temporary, generated image to an email?

I am trying to send image as email attachment programmatically, email is sent from my side, but doesnot go to my email inbox.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Harneet Kaur
  • 4,487
  • 1
  • 16
  • 16
  • 1
    "email is sent from my side, but does not go to my email inbox"... Spam filter? Rejected by SMTP server? Rejected by any other server along the route? What indication do you have that the problem is in the sending of the email via code and not anywhere else along the path of the email outside of your control? Have you tested it against a test email server which you do control and can monitor? – David Jul 03 '12 at 05:08
  • The above link does not solve my query... – Harneet Kaur Jul 03 '12 at 11:19

1 Answers1

1

Simply try this one -

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{"email"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Test");
//has to be an ArrayList
ArrayList<Uri> uris = new ArrayList<Uri>();
//convert from paths to Android friendly Parcelable Uri's
for (String file : filePaths)
{
    File fileIn = new File(file);
    Uri u = Uri.fromFile(fileIn);
    uris.add(u);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
context.startActivity(emailIntent);

Have a look at this answer Hope this helps you

Community
  • 1
  • 1
Praveenkumar
  • 24,084
  • 23
  • 95
  • 173