简体   繁体   中英

Sending email through intent without having to press send button

Currently I have a button that when pushed calls the Intent below.

Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharingIntent.putExtra(Intent.EXTRA_EMAIL,
new String[] { toString });
sharingIntent.putExtra(Intent.EXTRA_SUBJECT,
    "New Files from Safe Storage");
sharingIntent.setType("text/*");
startActivity(sharingIntent);

This intent then uses the default share activity to share the email with my attached file (which i took out for this example). When this code goes off it opens the gmail activity for me, but i still need to push the send button even though everything is filled in. Is there a way to make this instead just send automatically without showing the user the activity and having them forced to push "Send"?

Have a look on the following link, there is an answer for your question.

Sending Email in Android using JavaMail API without using the default android app(Builtin Email application)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM