我有函数发送邮件,它看起来像这样
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..."));
}
如果我在选择器中选择电子邮件应用程序,它将获得默认邮件地址并将其放在文本框中。
有没有办法将从邮件地址放入代码中,因此电子邮件应用程序将使用输入邮件地址而不是默认邮件地址
答案 0 :(得分:0)
我认为您无法更改邮件的默认设置,因为邮件客户端已链接到用户的邮件地址。