Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP : Authentication failed with MailException(null : null) #204

Open
Yowims opened this issue Aug 5, 2022 · 0 comments
Open

IMAP : Authentication failed with MailException(null : null) #204

Yowims opened this issue Aug 5, 2022 · 0 comments

Comments

@Yowims
Copy link

Yowims commented Aug 5, 2022

Hi,

I'm trying to log in my company mail address using IMAP protocol. I managed to get the server config using the Discover.discover() method, but when I try to use MailClient.connect() method, it throws me an error saying :

Exception has occurred.
MailException (MailException: null: null
)

My code :

    final config = await Discover.discover("[email protected]");
    final account;
    if (config == null) { // Never reached, but set in case of failure
      account = MailAccount.fromManualSettings(
          "My Name",
          "[email protected]",
          "outlook.office365.com",
          "smtp.office365.com",
          "P@ssword",
          outgoingClientDomain: "company.fr",
          outgoingPort: 587,
          outgoingSocketType: SocketType.starttls);
    } else {
      account = MailAccount.fromDiscoveredSettings(
          "My Name", "[email protected]", r"P@ssword", config,
          outgoingClientDomain: "company.fr");
    }

    final mailClient = MailClient(account, isLogEnabled: true);
    try {
      await mailClient.connect();
      print("mail client connected ! :D");

      final mimeMessage = buildMessage();
      await mailClient.sendMessage(mimeMessage);
    } on Exception catch (e) {
      Navigator.of(context).pop();
      rethrow;
    }

My logs :

flutter: failed to find settings for company.fr: imap: failure pop: failure smtp: failure
flutter: A: connecting to server outlook.office365.com:993 - secure: true, timeout: 0:00:10.000000
flutter: S: * OK The Microsoft Exchange IMAP4 service is ready. [UABSADMAUAAxADgAOQBDAEEAMAAwADUAMAAuAEUAVQBSAFAAMQA4ADkALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
flutter: C: a0 LOGIN "[email protected]" "(password scrambled)"
flutter: S: a0 NO LOGIN failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant