SmtpClient constructor Null safety

  1. String clientDomain,
  2. {EventBus? bus,
  3. bool isLogEnabled = false,
  4. String? logName,
  5. Duration? connectionTimeout,
  6. bool onBadCertificate(
    1. X509Certificate

Creates a new instance with the specified clientDomain that is associated with your service's domain, e.g. or

Set the eventBus to add your specific EventBus to listen to SMTP events. Set isLogEnabled to true to see log output. Set the logName for adding the name to each log entry. Set the connectionTimeout in case the connection connection should timeout automatically after the given time. onBadCertificate is an optional handler for unverifiable certificates. The handler receives the X509Certificate, and can inspect it and decide (or let the user decide) whether to accept the connection or not. The handler should return true to continue the SecureSocket connection.


  String clientDomain, {
  EventBus? bus,
  bool isLogEnabled = false,
  String? logName,
  Duration? connectionTimeout,
  bool Function(X509Certificate)? onBadCertificate,
})  : _eventBus = bus ?? EventBus(),
      _clientDomain = clientDomain,
        isLogEnabled: isLogEnabled,
        logName: logName,
        connectionTimeout: connectionTimeout,
        onBadCertificate: onBadCertificate,