Skip to content

Commit 2cf07dc

Browse files
Merge pull request #118 from SectorLabs/master
Fix sendMail
2 parents 702e422 + bbeafe1 commit 2cf07dc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

android/src/main/java/com/burnweb/rnsendintent/RNSendIntentModule.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ public void sendSms(String phoneNumberString, String body) {
322322

323323
@ReactMethod
324324
public void sendMail(String recepientString, String subject, String body) {
325-
String uriText = "mailto:" + Uri.encode(recepientString) +
326-
"?body=" + Uri.encode(body) +
327-
"&subject=" + Uri.encode(subject);
328-
329-
Intent sendIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uriText));
325+
Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
326+
sendIntent.setData(Uri.parse("mailto:"));
327+
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{recepientString});
328+
sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
329+
sendIntent.putExtra(Intent.EXTRA_TEXT, body);
330330
sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
331331

332332
//Check that an app exists to receive the intent

0 commit comments

Comments
 (0)