Android open emailclient programmatically

后端 未结 5 835
小鲜肉
小鲜肉 2020-12-10 12:57

Is it possible to open an emailclient such as gmail when I click a button in my app?

5条回答
  •  有刺的猬
    2020-12-10 13:15

    You can simply use below code when for no attachment:

    Intent i = new Intent(Intent.ACTION_SENDTO);
    i.setData(Uri.parse("mailto:support@mailname.com")); 
    i.putExtra(Intent.EXTRA_SUBJECT, "Feedback/Support");
    startActivity(Intent.createChooser(emailIntent, "Send feedback"));
    

    For details I recommend to visit: https://developer.android.com/guide/components/intents-common.html#Email

提交回复
热议问题