使用Intent时不显示电子邮件正文

neo*_*nik 3 email android android-intent

当我尝试发送电子邮件意图时,无论我使用的是INTENT.ACTION_SEND还是ACTION.SENDTO并使用股票索尼Xperia Active电子邮件客户端主题和收件人显示正常,但正文是空的,除了粘贴的标准评论客户端.在我的三星Galaxy Note 2上,相同的代码就像魅力一样.

    if(mPrefs.getBoolean("alternative_email_client", false)){
        Intent send = new Intent(Intent.ACTION_SENDTO);
        String uriText = "mailto:" + Uri.encode(emailStrings[6]) + 
               "?subject=" + Uri.encode("The subject") + 
               "&body=" + Uri.encode(emailBody);
        Uri uri = Uri.parse(uriText);
        send.setData(uri);
        startActivity(Intent.createChooser(send, "Email verschicken"));
    } else {
        Intent send = new Intent(Intent.ACTION_SEND);
        send.putExtra(Intent.EXTRA_EMAIL, emailStrings[6]);
        send.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
        send.putExtra(Intent.EXTRA_TEXT, emailBody);
        startActivity(Intent.createChooser(send, "Email verschicken"));
    }
Run Code Online (Sandbox Code Playgroud)

Asw*_*ran 7

要发送包含正文的电子邮件,请使用message/rfc822.

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("message/rfc822");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "to1@example.com", "to2@example.com" });
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject of the email");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Content of the email");
startActivity(sendIntent);
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.