sidlatau / flutter_email_sender

Allows send emails from flutter using native platform functionality.
Apache License 2.0
151 stars 84 forks source link

Sending emails on iOS fails #26

Open matthewrice345 opened 5 years ago

matthewrice345 commented 5 years ago

If on an iOS device the default mail client is removed but Gmail is installed nothing happens.

Steps to reproduce:

  1. Ensure gmail is installed.
  2. Remove the mail client from an iPhone.
  3. Use the plugin

Results: Nothing happens

xellDart commented 4 years ago

Same here

balajiks-dev commented 4 years ago

Any solution for this issues? I'm facing Module 'flutter_email_sender' not found

shadyshrif commented 4 years ago

Same error

I have this error when I send an email from form in flutter. Unhandled Exception: PlatformException(UNAVAILABLE, defualt mail app not available, null)

And Also

Unhandled Exception: PlatformException(not_available, No email clients found!, null)

alvindrakes commented 4 years ago

Same error here too. is it possible to use other email clients besides Mail on iOS?

tudor07 commented 4 years ago

I have Mail but I still get this error.

tudor07 commented 4 years ago

@matthewrice345 have you found some workaround or some other library?

matthewrice345 commented 4 years ago

From what i've been able to learn if the user on iOS does not have a default mail client setup it fails to send an email. My "solution" for now is to wrap the call in a try/catch and show a snackbar if an error happens. I believe the exception does say something about no default mail client being setup. At this point i'm not entirely sure the library can do much or if this is because iOS lacks robust default apps support. (rumor is it's coming though)

A circumstance where this may happen is when a user skips the Mail app and goes directly to another client. (gmail or whatever)

tudor07 commented 4 years ago

Yes, this is true. It's not this lib's fault. I notice that If I don't have an email account configured this library throes PlatformException with code not_available, but if I use a mailto: link it starts a screen to configure my account. It would be cool if this library did the same thing.

StephanCassel commented 4 years ago

Same problem. I think @tudor07 is pointing in the right direction: the "mailto:-approach".

ghost commented 4 years ago

I had the same issue. What helped was setting the default email under "contacts". I actually had to download the original ios email app first, since I only had gmail on my phone. The default settings didn't register the gmail account properly at first without the original email app.

devjeff commented 3 years ago

The mailto-approach didn't work for me either when the default mail app was not configured. A nice workaround that I found is using the share plugin as a fallbackt if the email sending fails.

goneall commented 1 year ago

From reading through the issue - it looks like iOS does not really support linking an email app to another iOS app, so there won't be any solution which uses the emailer on the client. This would include the URL solution above.

If we want to support iOS - we're going to need to implement this without relying an an email client.

I'll research other packages which can collect feedback.

rafaellop commented 1 year ago

Results: Nothing happens

Something happens... and it's an exception which you can eventually catch and show a message that gmail is not supported.

    try {
      await FlutterEmailSender.send(email);      
    } catch (e) {
      if ((e as PlatformException).code == 'not_available') {
         print('Gmail not supported');
      }
    }
manukumarsb7 commented 7 months ago

Facing the same issue. Any solution for this issues?

Yousafkhanzadaa commented 4 months ago

Any solution?

balajiks-dev commented 3 months ago

Its not the solution but its using try catch block to prevent from crashing the app and intimate the user about the issue.

try { await FlutterEmailSender.send(email); } catch (e) { if ((e as PlatformException).code == 'not_available') { print('Gmail not supported'); } }