How to send email from android (using the default account)?

社会主义新天地 提交于 2019-12-13 05:35:04

问题


I would like to leverage the goggle account credentials belonging to the synced user on android to send emails in the background, it is possible to achieve that ?

If not, is it possible to ask the user to send an email (with an intent) AND get the receiver's email ? maybe by calling startActivityForResult ?

Cheers, Ze


回答1:


You question is to send email via intent

Intent emailIntent=new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL,new String[]{"email@address.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "body");
emailIntent.setType("text/plain");
startActivity(emailIntent);

To send email in background use JavaMail API with activation framework.



来源:https://stackoverflow.com/questions/4541111/how-to-send-email-from-android-using-the-default-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!