通过Intent打开电子邮件客户端(但不发送消息)

问题描述:

是否有一种方法可以以编程方式打开电子邮件客户端,而无需强制发送邮件?我只希望该应用程序允许用户打开其电子邮件客户端以进行电子邮件检查:)

Is there a way to programically open email client, without a need to forcing message send? I just want the app to let user open his email client for email checking purposes :)

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");
    startActivity(Intent.createChooser(intent, ""));

此代码有效,但会强制用户发送新消息.

This code works but it forces user to send a new message.

我认为您应该将Intent.ACTION_SEND替换为Intent.ACTION_VIEW
我确信这会起作用,因为这会提示支持MIME的应用程序列表键入"message/rfc822",这样它将在您的设备(而不是gmail应用)中包括您的默认电子邮件客户端.

该代码怎么样:

I think you should replace Intent.ACTION_SEND to Intent.ACTION_VIEW,
i am sure this will work as this will prompt with list of application which support MIME type "message/rfc822" so it will include your default email client in your device other than gmail app.

How about this code:

final Intent emailLauncher = new Intent(Intent.ACTION_VIEW);
emailLauncher.setType("message/rfc822");
try{
       startActivity(emailLauncher);
}catch(ActivityNotFoundException e){

}