T.Barrett T.Barrett - 1 month ago 9
Android Question

android ACTION_SENDTO creates email doesn't send it

Have working code that 1) opens an email client on an android device and 2) successfully populates all the fields needed to send a message. This includes the to, from, subject and message body.

e String mailMsg = "mailto:elmer@gmail.com" +
"?cc="+"" + //needed to fill out email properly
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(emailBody);

Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.setData(Uri.parse(mailMsg));
try{
context.startActivity(emailIntent);
}catch (ActivityNotFoundException ae){
Log.d("TEST100 ","Error sending email");
}


Again the code works fine in terms of opening the email client, creating an populating the email message but, it does not send the email. Could it be because I have multiple email providers? The code always manages to connect to and work with my mai based provider.

Have read the google documentation and most relevant posts in stackoverflow, is it possible to:
1. trigger the sending of the email message without user involvement?
2. mask the display/process of creating the email?

Any information appreciated

Answer

is it possible to: trigger the sending of the email message without user involvement?

Fortunately, no.

mask the display/process of creating the email?

Fortunately, no.

Malware authors, spammers, and the like would love to have the ability to send an email, without user involvement, using the user's own email account. Most users would find this behavior to be inappropriate.

If you want to send an email without user involvement, have your Web service send the email on your behalf, using your own email account and your own mail server.