MailAccount.fromManualSettingsWithAuth constructor

MailAccount.fromManualSettingsWithAuth({
  1. required String name,
  2. required String email,
  3. required String incomingHost,
  4. required String outgoingHost,
  5. required MailAuthentication auth,
  6. String userName = '',
  7. ServerType incomingType = ServerType.imap,
  8. ServerType outgoingType = ServerType.smtp,
  9. MailAuthentication? outgoingAuth,
  10. String outgoingClientDomain = 'enough.de',
  11. dynamic incomingPort = 993,
  12. dynamic outgoingPort = 465,
  13. SocketType incomingSocketType = SocketType.ssl,
  14. SocketType outgoingSocketType = SocketType.ssl,
  15. bool supportsPlusAliases = false,
  16. List<MailAddress> aliases = const [],
})

Creates a mail account from manual settings with the specified auth.

You need to specify the account name, the associated email, the incomingHost, outgoingHost and auth.

You can specify a different authentication for the outgoing server using the outgoingAuth parameter.

You should specify the outgoingClientDomain for sending messages, this defaults to enough.de.

The incomingType defaults to ServerType.imap, the incomingPort to 993 and the incomingSocketType to SocketType.ssl.

The outgoingType defaults to ServerType.smtp, the outgoingPort to 465 and the outgoingSocketType to SocketType.ssl.

Implementation

factory MailAccount.fromManualSettingsWithAuth({
  required String name,
  required String email,
  required String incomingHost,
  required String outgoingHost,
  required MailAuthentication auth,
  String userName = '',
  ServerType incomingType = ServerType.imap,
  ServerType outgoingType = ServerType.smtp,
  MailAuthentication? outgoingAuth,
  String outgoingClientDomain = 'enough.de',
  incomingPort = 993,
  outgoingPort = 465,
  SocketType incomingSocketType = SocketType.ssl,
  SocketType outgoingSocketType = SocketType.ssl,
  bool supportsPlusAliases = false,
  List<MailAddress> aliases = const [],
}) {
  final incoming = MailServerConfig(
    authentication: auth,
    serverConfig: ServerConfig(
      type: incomingType,
      hostname: incomingHost,
      port: incomingPort,
      socketType: incomingSocketType,
      authentication: auth.authentication,
      usernameType: UsernameType.unknown,
    ),
  );
  final outgoing = MailServerConfig(
    authentication: outgoingAuth ?? auth,
    serverConfig: ServerConfig(
      type: outgoingType,
      hostname: outgoingHost,
      port: outgoingPort,
      socketType: outgoingSocketType,
      authentication: auth.authentication,
      usernameType: UsernameType.unknown,
    ),
  );

  return MailAccount(
    name: name,
    email: email,
    incoming: incoming,
    outgoing: outgoing,
    userName: userName,
    outgoingClientDomain: outgoingClientDomain,
    supportsPlusAliases: supportsPlusAliases,
    aliases: aliases,
  );
}