如何从我的Android应用程序发送电子邮件?我正在为Android编写一个应用程序。我怎样才能用它发一封电子邮件?
3 回答
![?](http://img1.sycdn.imooc.com/54584dd900014f6c02200220-100-100.jpg)
DIEA
TA贡献1820条经验 获得超2个赞
我已经使用了很久以前,它似乎很好,没有出现非电子邮件应用程序。另一种发送电子邮件的方式是:
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
intent.putExtra(Intent.EXTRA_TEXT, "Body of email");
intent.setData(Uri.parse("mailto:default@recipient.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
startActivity(intent);
- 3 回答
- 0 关注
- 474 浏览
添加回答
举报
0/150
提交
取消