我正在构建一个能够通过电子邮件发送信息的应用程序。当我单击发送电子邮件按钮时,会显示电话的联系人列表并从所选人员那里检索电子邮件。然后根据我选择通过“Gmail”还是“Hotmail”发送,我会得到不同的结果。对于 gmail,此人的电子邮件地址位于“发件人”字段中,按“收件人”字段不会执行任何操作。另一方面,在 hotmail 中,检索到的电子邮件地址忽略了 '@hotmail.com' 部分(我认为它实际上在 'to' 字段中,但没有任何指示(尽管它在顶部!),然后单击“发送”会导致无效的电子邮件地址消息。单击该地址也无济于事。这是我的发送代码:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_EMAIL, email);
System.out.println("email set as: " + email);
final String subject = diaryDetailedName + "'s diary entry ";
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
final String emailBody = "I have an entry in my diary that you should know about. " +
"Its for " + detailedTitle + " which will involve " + detailedDesc +
". This is on " + dDate + " at " + detailedTime + ". Please get in touch if you need to know more.";
emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody);
DiaryDetailed.this.startActivity(Intent.createChooser(emailIntent, "Send mail in:"));
有任何想法吗?提前致谢!