Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Outlook and Windows Attachment issues, resolve merge conflict #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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")) {
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"));
Expand All @@ -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);
}
Expand Down