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
我认为您无法更改邮件的默认设置,因为邮件客户端已链接到用户的邮件地址。
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.