From 73f2fe36d2338327f75b5e2a1dc81f0168d2d63e Mon Sep 17 00:00:00 2001 From: max Date: Wed, 30 Jun 2021 10:35:46 -0500 Subject: [PATCH 1/2] Add Outlook logic from kacyn --- .../main/java/com/chirag/RNMail/RNMailModule.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/chirag/RNMail/RNMailModule.java b/android/src/main/java/com/chirag/RNMail/RNMailModule.java index e93973e..54f7547 100644 --- a/android/src/main/java/com/chirag/RNMail/RNMailModule.java +++ b/android/src/main/java/com/chirag/RNMail/RNMailModule.java @@ -56,9 +56,15 @@ private String[] readableArrayToStringArray(ReadableArray r) { @ReactMethod public void mail(ReadableMap options, Callback callback) { - Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); - Intent selectorIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); - i.setSelector(selectorIntent); + Intent i; + if (options.hasKey("attachment") && !options.isNull("attachment")) { + Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); + Intent selectorIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); + i.setSelector(selectorIntent); + } 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")); @@ -67,7 +73,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); } From 65f16047846623b1024f7c06a54c4fe9c411ca91 Mon Sep 17 00:00:00 2001 From: max Date: Wed, 30 Jun 2021 11:58:21 -0500 Subject: [PATCH 2/2] Remove unnecessary type declaration --- android/src/main/java/com/chirag/RNMail/RNMailModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/chirag/RNMail/RNMailModule.java b/android/src/main/java/com/chirag/RNMail/RNMailModule.java index 54f7547..2275d18 100644 --- a/android/src/main/java/com/chirag/RNMail/RNMailModule.java +++ b/android/src/main/java/com/chirag/RNMail/RNMailModule.java @@ -58,7 +58,7 @@ private String[] readableArrayToStringArray(ReadableArray r) { public void mail(ReadableMap options, Callback callback) { Intent i; if (options.hasKey("attachment") && !options.isNull("attachment")) { - Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); + i = new Intent(Intent.ACTION_SEND_MULTIPLE); Intent selectorIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); i.setSelector(selectorIntent); } else {