checkCredentials function

Future<void> checkCredentials(
  1. SmtpServer smtpServer, {
  2. Duration? timeout,
})

Convenience method for testing SmtpServer configuration.

Throws following exceptions if the configuration is incorrect or there is no internet connection: SmtpClientAuthenticationException, SmtpClientCommunicationException, SocketException others

Implementation

Future<void> checkCredentials(SmtpServer smtpServer,
    {Duration? timeout}) async {
  var connection = await client.connect(smtpServer, timeout);
  await client.close(connection);
}