打开一个电子邮件客户端上点击一个按钮客户端、按钮、电子邮件

由网友(吃醋是最诚实的告白)分享简介:我设计一个应用程序中,我需要在点击一个按钮打开一个电子邮件客户端。电子邮件客户端应打开了pre定义的主题和到的地址。有没有办法实现这一点?请为我提供的解决方案和code例如,如果可能的... I am designing an app in which i need to open an email client o...

我设计一个应用程序中,我需要在点击一个按钮打开一个电子邮件客户端。电子邮件客户端应打开了pre定义的主题和到的地址。有没有办法实现这一点?请为我提供的解决方案和code例如,如果可能的...

I am designing an app in which i need to open an email client on clicking a button. The email client should be opened with a pre-defined subject and 'to' address. Is there a way to attain this? Please provide me the solution and a code example if possible...

推荐答案

是这样的:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "some@email.address" });
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "mail body");
startActivity(Intent.createChooser(intent, ""));

另外,你可以使用IntentFactory.getSendEmailIntent(String邮寄地址,字符串mailCC, 字符串主题,CharSequence的身体,文件附件)。

Alternatively, you could use IntentFactory.getSendEmailIntent(String mailTo, String mailCC, String subject, CharSequence body, File attachment).

阅读全文

相关推荐

最新文章