Essentials: Problems with sending email message on iOS

Created on 11 Jul 2018  路  4Comments  路  Source: xamarin/Essentials

Bug report best practices: Submitting Issues

Description

I'm not able to send an email message from iOS using Xamarin.Essentials. The app crashes with the following exception: -canOpenURL: failed for URL: "mailto:" - error: "This app is not allowed to query for scheme mailto".

Steps to Reproduce

private async void SendMail()
{
    try
    {
        var message = new EmailMessage
        {
            To = new List<string> { "[email protected]" },
            Subject = "Subject",
            Body = "Body"
        };

        await Email.ComposeAsync(message);
    }
    catch (Exception ex)
    {
        Debug.WriteLine($"{ex}");
    }
}

Expected Behavior

I want to be able to send a message from iOS, because the exact same code works great on UWP and Android.

Actual Behavior

Unable to send an email message on iOS. The app crashes with the following exception: -canOpenURL: failed for URL: "mailto:" - error: "This app is not allowed to query for scheme mailto".

Basic Information

  • Version with issue: 0.8.0-preview
  • Last known good version: ?
  • IDE: VS 2017 15.7.4
  • Platform Target Frameworks:

    • iOS: 11.4

  • Nuget Packages: 0.8.0-preview
  • Affected Devices: iOS

Screenshots

Reproduction Link

Please see under Steps to Reproduce for a code sample

Most helpful comment

Thanks @jamesmontemagno,
it is only a problem within the simulator, on the device everything works as expected.

All 4 comments

Are you running this on a simulator or on a device? I believe that this API is only available on devices.

Thanks @jamesmontemagno,
it is only a problem within the simulator, on the device everything works as expected.

@jamesmontemagno can you please make sure this gets documented. I was ready to file a bug since I was running into this as well but it's nowhere in the docs that it'll throw this exception on the iOS simulator.

Was this page helpful?
0 / 5 - 0 ratings