-1

I was trying to send an email with image as attachment.I see the item attached to the mail while sending , but in the inbox i see just the mail message but attachment missing. Please help me if my code went wrong somewhere

    ArrayList<String> fetchList= new ArrayList<>();
    fetchList= getIntent().getStringArrayListExtra("Uri");
    ArrayList<Uri> uriList=new ArrayList<>();
    for (int i=0;i<fetchList.size();i++){
        uriList.add(i,Uri.parse(fetchList.get(i)));
    }

    public void sendClicked(View view) {
    String emailBody =textMessage.getText().toString();
    String emailSubject=textSubject.getText().toString();
    String Email_To[]=new String[]{"kittutanu@yahoo.co.in"};

    final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setType("text/plain"); 
    intent.putExtra(Intent.EXTRA_EMAIL, Email_To);
    intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
    intent.putExtra(Intent.EXTRA_TEXT, emailBody);
    if (uriList != null) {
        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
    }
    try {
        this.startActivity(intent);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
    }
}

}

Kittu
  • 61
  • 9

1 Answers1

0

Have you tried with multipart/alternative or multipart/mixed type?

Here is an example How to send an email with a file attachment in Android

Community
  • 1
  • 1