In my application I wish to send a server-side authentication email. I'd like to open a chooser that shows every email application available on the device.
I can do this with the following lines code:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:"));
Problem 1: This will always compose an empty message, all I want to do is display every email application so that the user will be directed to their desired inbox.
Upon further research I found that I can open the email application (without composing a new message) by adding a category type:
Intent emailIntent = new Intent(Intent.ACTION_MAIN);
emailIntent.addCategory(Intent.CATEGORY_APP_EMAIL);
Problem 2: This solution will only show the default email application only (testing on a Samsung device means that only the 'Email' app is shown not third party apps such as Gmail, Outlook etc). This is not ideal as I'd like to offer the user the ability to open their email client of choice.
Most resources online show how to send an email via your own application however I have not found any way to show the user every email app but NOT compose a new email.
Any help would be greatly appreciated, thanks!
ProtonMail also offers calendar and storage drive products with all email accounts, making it one of the best alternatives to Gmail. Features: Android and iOS apps, along with a web-based inbox.
Gmail (Android, iOS: Free) The Gmail app supports multiple accounts and notifications, while also offering particularly handy tools for organizing your emails.
Your CATEGORY_APP_EMAIL
is documented to specifically be not used the way that you are using it. It is for makeMainSelectorActivity()
, which should in theory give you what you want. Try:
Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
Intent.CATEGORY_APP_EMAIL);
and see if that gives you what you want.
I'd like to open a chooser that shows every email application available on the device.
Bear in mind that the user may be using none of these. They might use Web mail in a browser. They might not access email on their mobile device. They might not use email. They might think that email is something for old people. And so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With