0

我目前正在开发一个 android 项目,我正在添加一个偏好,以便能够向我发送电子邮件。我正在使用ACTION_SENDTO意图发送电子邮件,但它回来并说No apps can perform this action

下面是我正在使用的代码

Intent intent = new Intent(Intent.ACTION_SENDTO);
                intent.setType("text/plain");
                intent.putExtra(Intent.EXTRA_EMAIL, "someone@example.com");
                intent.putExtra(Intent.EXTRA_SUBJECT, "Check out this android app");
                intent.putExtra(Intent.EXTRA_TEXT, "Check out this new app in the Google Play Store. Its from Boardies IT Solutions and is called Boardies Password Manager. You can find it at https://play.google.com/store/apps/details?id=com.BoardiesITSolutions.PasswordManager");
                startActivity(Intent.createChooser(intent, "Send Email"));

感谢您的任何帮助,您可以提供

4

2 回答 2

1

您需要添加以下内容

intent.setData(Uri.parse("mailto:" + "email@bla.com")); // 如果不是特异性,则留空

于 2012-12-20T01:30:51.390 回答
0

我认为您应该替换Intent.ACTION_SENDTOIntent.ACTION_SEND
希望这对您有用。

这段代码怎么样:

final Intent emailLauncher = new Intent(Intent.ACTION_SEND);
emailLauncher.setType("message/rfc822");
emailLauncher.putExtra(Intent.EXTRA_EMAIL, "username@domain.com");
emailLauncher.putExtra(Intent.EXTRA_SUBJECT, "check this subject line");
emailLauncher.putExtra(Intent.EXTRA_TEXT, "hey check this message body!");
try{
       startActivity(emailLauncher);
}catch(ActivityNotFoundException e){

}
于 2014-06-10T07:20:01.653 回答