3

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.

Matt Ward
  • 1,095
  • 1
  • 14
  • 28
  • 1
    On iOS it’s possible in Swift by doing this: https://stackoverflow.com/questions/46649692/ios-swift-open-mail-app-in-inbox-emails/46661209 – Dai Feb 05 '19 at 14:17

1 Answers1

7

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.

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91