I have function send mail and it looks like this
private void email(String emailTo, String subject, String emailText, ArrayList<DummyItem> lstItemsUpload) {
// need to "send multiple" to get more than one attachment
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{ emailTo});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, emailText);
// has to be an ArrayList
ArrayList<Uri> uris = new ArrayList<Uri>();
// convert from paths to Android friendly Parcelable Uri's
for (int i = 0; i < lstItemsUpload.size(); i++) {
MyItem myItem = lstItemsUpload.get(i);
File fileIn = new File(myItem.getPath());
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
If i choose Email application in chooser, it’s will get default mail address and place it in from text box.
Is there any way to put the from mail address in the code, so the email application will use the input mail address instead of default mail address
I don’t think you can change the default from mail since the mail client is linked to the user’s mail address.