How to set mime type for Android email attachment
Asked Answered
R

0

9

I'm sending emails via an Intent. Sometimes they need to have an attachment, but the attachment gets the same MIME type as the main email (message/rf822).

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address });
intent.putExtra(Intent.EXTRA_TEXT, body);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
if (fileName != null) {
    intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + fileName));
}
intent.setType("message/rfc822");

Is there a way to specify the MIME type for the attachment ?

Raceme answered 15/2, 2014 at 23:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.