0

I am using the following code from here to start an e-mail:

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

The code is as follows:

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 
} 

}

When testing on my phone (HTC Desire) I don't get the option for using my Exchange/Outlook email (note I do when I click an e-mail link on the web for example).

Instead I get option for 'Gmail' and 'Evernote - Create Note' (very strange).

The code works as expected with Gmail, which is great, but I need it to work for Outlook. Anyone got an idea what the issue is? Thanks.

Community
  • 1
  • 1
Scamparelli
  • 756
  • 1
  • 12
  • 28

1 Answers1

0

Apologies, but I asked this question twice (some time had passed between each post and I had forgot I had already asked!).

Anyway, found the solution here: How to open Email program via Intents (but only an Email program)

Changing the MIME type is the answer, this is what I did in my app to change the same behavior. I used intent.setType("message/rfc822");

Worked like a dream!

Community
  • 1
  • 1
Scamparelli
  • 756
  • 1
  • 12
  • 28