Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Fix outlook send with attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEliasen committed Jan 14, 2019
1 parent 68c5cc0 commit 7e6d06a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions android/src/main/java/com/chirag/RNMail/RNMailModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ private String[] readableArrayToStringArray(ReadableArray r) {

@ReactMethod
public void mail(ReadableMap options, Callback callback) {
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
//i.setData(Uri.parse("mailto:"));
i.setType("text/plain");
Intent i;

if (options.hasKey("attachments") && !options.isNull("attachments")) {
i = new Intent(Intent.ACTION_SEND_MULTIPLE);
i.setType("vnd.android.cursor.dir/email");
} else {
i = new Intent(Intent.ACTION_SENDTO);
i.setData(Uri.parse("mailto:"));
}

if (options.hasKey("subject") && !options.isNull("subject")) {
i.putExtra(Intent.EXTRA_SUBJECT, options.getString("subject"));
Expand All @@ -66,7 +72,7 @@ public void mail(ReadableMap options, Callback callback) {
if (options.hasKey("body") && !options.isNull("body")) {
String body = options.getString("body");
if (options.hasKey("isHTML") && options.getBoolean("isHTML")) {
i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body));
i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body).toString());
} else {
i.putExtra(Intent.EXTRA_TEXT, body);
}
Expand Down

0 comments on commit 7e6d06a

Please sign in to comment.