flutter_email_sender icon indicating copy to clipboard operation
flutter_email_sender copied to clipboard

Sending emails on iOS fails

Open matthewrice345 opened this issue 5 years ago • 16 comments

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

matthewrice345 avatar Aug 30 '19 20:08 matthewrice345

Same here

xellDart avatar Jan 12 '20 01:01 xellDart

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

balajiks-dev avatar Feb 25 '20 04:02 balajiks-dev

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)

shadyshrif avatar Feb 25 '20 23:02 shadyshrif

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

alvindrakes avatar Mar 29 '20 07:03 alvindrakes

I have Mail but I still get this error.

tudor07 avatar Apr 27 '20 11:04 tudor07

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

tudor07 avatar Apr 30 '20 08:04 tudor07

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)

matthewrice345 avatar Apr 30 '20 14:04 matthewrice345

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.

tudor07 avatar May 11 '20 12:05 tudor07

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

StephanCassel avatar Jun 03 '20 08:06 StephanCassel

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.

ghost avatar Jul 28 '20 09:07 ghost

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.

devjeff avatar Mar 09 '21 17:03 devjeff

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.

goneall avatar Nov 06 '22 00:11 goneall

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');
      }
    }

rafaellop avatar Dec 20 '22 19:12 rafaellop

Facing the same issue. Any solution for this issues?

manukumarsb7 avatar Feb 12 '24 04:02 manukumarsb7

Any solution?

Yousafkhanzadaa avatar May 08 '24 14:05 Yousafkhanzadaa

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'); } }

balajiks-dev avatar Jun 26 '24 14:06 balajiks-dev