This repository was archived by the owner on Aug 5, 2020. It is now read-only.
File tree 1 file changed +10
-4
lines changed
android/src/main/java/com/chirag/RNMail
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) {
55
55
56
56
@ ReactMethod
57
57
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
+ }
61
67
62
68
if (options .hasKey ("subject" ) && !options .isNull ("subject" )) {
63
69
i .putExtra (Intent .EXTRA_SUBJECT , options .getString ("subject" ));
@@ -66,7 +72,7 @@ public void mail(ReadableMap options, Callback callback) {
66
72
if (options .hasKey ("body" ) && !options .isNull ("body" )) {
67
73
String body = options .getString ("body" );
68
74
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 () );
70
76
} else {
71
77
i .putExtra (Intent .EXTRA_TEXT , body );
72
78
}
You can’t perform that action at this time.
0 commit comments