Using Android Intent.ACTION_SEND for sending email

前端 未结 17 1259
野趣味
野趣味 2020-11-29 23:07

I\'m using Intent.ACTION_SEND to send an email. However, when I call the intent it is showing choices to send a message, send an email, and also to

17条回答
  •  情深已故
    2020-11-29 23:34

    I had a similar problem with my app. I recently found this link form the official android developers site that really helps! Common Intents: Email

    TL;DR:

    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:"));
    

    Now, you will only be shown email clients!

    You can add a Subject and Body by doing this:

    intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
    intent.putExtra(Intent.EXTRA_TEXT, "Body" );
    

提交回复
热议问题