当我尝试发送电子邮件意图时,无论我使用的是INTENT.ACTION_SEND还是ACTION.SENDTO并使用股票索尼Xperia Active电子邮件客户端主题和收件人显示正常但身体是空的,除了粘贴的标准评论客户端.在
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")); }要发送包含正文的电子邮件,请使用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);
希望这可以帮助.