【问题标题】:Intent to start e-mail not showing Exchange Mail (Outlook) as an option打算启动电子邮件不显示 Exchange 邮件 (Outlook) 作为选项
【发布时间】:2012-09-13 01:30:18
【问题描述】:

我正在使用以下代码从这里开始发送电子邮件:

Android: Using email intent to send email, possible to alter message just before sending?

代码如下:

private void sendEmail(String recipient, String subject, String message) { 
try { 
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
    emailIntent.setType("plain/text"); 
    if (recipient != null)  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{recipient}); 
    if (subject != null)    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); 
    if (message != null)    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); 

    startActivity(Intent.createChooser(emailIntent, "Send mail...")); 

} catch (ActivityNotFoundException e) { 
    // cannot send email for some reason 
} 

}

在我的手机 (HTC Desire) 上进行测试时,我没有选择使用我的 Exchange/Outlook 电子邮件(请注意,例如,当我单击网络上的电子邮件链接时我会这样做)。

相反,我得到了“Gmail”和“Evernote - Create Note”的选项(很奇怪)。

该代码在 Gmail 中按预期工作,这很棒,但我需要它才能在 Outlook 中工作。有人知道问题是什么吗?谢谢。

【问题讨论】:

    标签: android-intent outlook


    【解决方案1】:

    抱歉,但我问了两次这个问题(每次发帖之间已经过了一段时间,我忘记了我已经问过了!)。

    无论如何,在这里找到解决方案:How to open Email program via Intents (but only an Email program)

    更改 MIME 类型就是答案,这就是我在我的应用程序中所做的以更改相同的行为。我用了 intent.setType("message/rfc822");

    像梦一样工作!

    【讨论】:

      猜你喜欢
      • 2012-06-24
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 1970-01-01
      • 2016-01-20
      • 1970-01-01
      • 1970-01-01
      • 2017-04-03
      相关资源
      最近更新 更多