This repository was archived by the owner on Aug 5, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
android/src/main/java/com/chirag/RNMail Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,15 @@ private String[] readableArrayToStringArray(ReadableArray r) {
5555
5656 @ ReactMethod
5757 public void mail (ReadableMap options , Callback callback ) {
58- Intent i = new Intent (Intent .ACTION_SEND_MULTIPLE );
59- //i.setData(Uri.parse("mailto:"));
60- i .setType ("text/plain" );
58+ Intent i ;
59+
60+ if (options .hasKey ("attachments" ) && !options .isNull ("attachments" )) {
61+ i = new Intent (Intent .ACTION_SEND_MULTIPLE );
62+ i .setType ("vnd.android.cursor.dir/email" );
63+ } else {
64+ i = new Intent (Intent .ACTION_SENDTO );
65+ i .setData (Uri .parse ("mailto:" ));
66+ }
6167
6268 if (options .hasKey ("subject" ) && !options .isNull ("subject" )) {
6369 i .putExtra (Intent .EXTRA_SUBJECT , options .getString ("subject" ));
@@ -66,7 +72,7 @@ public void mail(ReadableMap options, Callback callback) {
6672 if (options .hasKey ("body" ) && !options .isNull ("body" )) {
6773 String body = options .getString ("body" );
6874 if (options .hasKey ("isHTML" ) && options .getBoolean ("isHTML" )) {
69- i .putExtra (Intent .EXTRA_TEXT , Html .fromHtml (body ));
75+ i .putExtra (Intent .EXTRA_TEXT , Html .fromHtml (body ). toString () );
7076 } else {
7177 i .putExtra (Intent .EXTRA_TEXT , body );
7278 }
You can’t perform that action at this time.
0 commit comments