MailAccount.fromDiscoveredSettings constructor

MailAccount.fromDiscoveredSettings({
  1. required String name,
  2. required String email,
  3. required String password,
  4. required ClientConfig config,
  5. required String userName,
  6. String outgoingClientDomain = 'enough.de',
  7. String? loginName,
  8. bool supportsPlusAliases = false,
  9. List<MailAddress> aliases = const [],
})

Creates a mail account with the given name for the specified email from the discovered config with a a plain authentication for the preferred incoming and preferred outgoing server.

You nee to specify the password.

Specify the userName if it cannot be deducted from the email or the discovery config.

For SMTP usage you also should define the outgoingClientDomain, which defaults to enough.de.

Implementation

factory MailAccount.fromDiscoveredSettings({
  required String name,
  required String email,
  required String password,
  required ClientConfig config,
  required String userName,
  String outgoingClientDomain = 'enough.de',
  String? loginName,
  bool supportsPlusAliases = false,
  List<MailAddress> aliases = const [],
}) =>
    MailAccount.fromDiscoveredSettingsWithAuth(
      name: name,
      email: email,
      userName: userName,
      auth: PlainAuthentication(
        loginName ??
            getLoginName(
              email,
              config.preferredIncomingServer.toValueOrThrow(
                'no preferred incoming server found',
              ),
            ),
        password,
      ),
      config: config,
      outgoingClientDomain: outgoingClientDomain,
      supportsPlusAliases: supportsPlusAliases,
      aliases: aliases,
    );