问题
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