How to send emails from my Android application?

前端 未结 21 2682
春和景丽
春和景丽 2020-11-22 00:38

I am developing an application in Android. I don\'t know how to send an email from the application?

21条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 00:47

    I use the below code in my apps. This shows exactly email client apps, such as Gmail.

        Intent contactIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getString(R.string.email_to), null));
        contactIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject));
        startActivity(Intent.createChooser(contactIntent, getString(R.string.email_chooser)));
    

提交回复
热议问题