How to send email from android (using the default

2019-09-01 16:17发布

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条回答
做个烂人
2楼-- · 2019-09-01 16:31

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.

查看更多
登录 后发表回答