0

我有功能发送邮件,它看起来像这样

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..."));
    }

如果我在选择器中选择电子邮件应用程序,它将获取默认邮件地址并将其从文本框中放入。

有没有办法将发件人邮件地址放在代码中,所以电子邮件应用程序将使用输入邮件地址而不是默认邮件地址

4

1 回答 1

0

我认为您不能更改邮件的默认设置,因为邮件客户端链接到用户的邮件地址。

于 2012-09-26T09:17:30.890 回答