I have an app that needs to prompt the user to open an email that's just been sent to them. It would be a great feature if it automatically opened the email app for them.
I currently have this code to open the email app and create a new draft email:
Device.OpenUri(new Uri("mailto://"));
I need this to run without opening a new email, just take them to their default mail app.
This is not possible to do in a purely cross-platform manner without the mailto:// URI which all systems understand. If you wanted to just open the mail client, you would have to check if your target OS supports such intent / URI and open it in a platform-specific manner.
Update: I have found platform specific solutions for Android and iOS.
Android
var intent = PackageManager.GetLaunchIntentForPackage("com.android.email");
StartActivity(intent);
iOS
UIApplication.SharedApplication.OpenUrl("message://");
UWP
In case of UWP mailto: seems to be the right option according to Docs. Unfortunately from my testing it does try to create a new e-mail with the built in Outlook Mail app. I will report that as a issue.
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