I am trying to send an email from my android app. It works well for me with this code
public void sendEmail(View v)
{
StringBuilder msgBody = new StringBuilder();
msgBody.append("name ").append("me").append("\n");
msgBody.append("name ").append("you").append("\n");
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
intent.putExtra(Intent.EXTRA_TEXT, " "+ msgBody.toString());
intent.setData(Uri.parse("mailto:user@hotmail.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
startActivity(intent);
}
With this code i can specify the reception's email. However, i need to specify the senders email as well.
Any help ? thanks in advance