2013-05-11 25 views
3

当我尝试发送电子邮件意向时,无论我使用INTENT.ACTION_SEND还是使用ACTION.SENDTO并使用股票Sony 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")); 
    } 

回答

6

的类型要与身体,利用消息/ RFC822发送电子邮件。

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.setType("message/rfc822"); 
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]", "[email protected]" }); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject of the email"); 
sendIntent.putExtra(Intent.EXTRA_TEXT, "Content of the email"); 
startActivity(sendIntent); 

希望这会有所帮助。

+0

好吧,这有助于身体,但使用这个我得到一个新的问题:收件人不见了。如何解决这个问题? – neominik 2013-05-15 10:39:00

+0

奇怪。我尝试过使用Gmail,我确实看到了收件人。你想从哪个应用发送电子邮件? – 2013-05-16 00:22:37

+0

这也适用于我:我忘记为EXTRA_EMAIL使用字符串数组。它不适用于单个字符串。 – neominik 2013-05-21 10:40:08

0

尝试添加消息

... 
emailIntent.setType("plain/text"); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, myMessage); 
... 
+0

嗯,我真的认为我会有。但即使我添加了该行,该正文也不会显示在股票电子邮件应用程序中。 – neominik 2013-05-15 10:37:23

相关问题