Java – Send email via intent without pressing the send button

Send email via intent without pressing the send button… here is a solution to the problem.

Send email via intent without pressing the send button

Currently I have a button that invokes the intent below when pressed.

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 attachments (which I took out in this example). When this code closes, it opens the gmail activity for me, but I still need to press the send button even though everything is filled in. Is there a way to have it send automatically without showing the activity to the user and forcing them to insert “send”?

Solution

Related Problems and Solutions