authenticate method
Future<SmtpResponse>
authenticate(
- String name,
- String password, [
- AuthMechanism authMechanism = AuthMechanism.plain
Signs in the user with the given name and password.
For AuthMechanism.xoauth2 the password must be the OAuth token.
By default the authMechanism AUTH PLAIN is being used.
Implementation
Future<SmtpResponse> authenticate(String name, String password,
[AuthMechanism authMechanism = AuthMechanism.plain]) {
late SmtpCommand command;
switch (authMechanism) {
case AuthMechanism.plain:
command = SmtpAuthPlainCommand(name, password);
break;
case AuthMechanism.login:
command = SmtpAuthLoginCommand(name, password);
break;
case AuthMechanism.cramMd5:
command = SmtpAuthCramMd5Command(name, password);
break;
case AuthMechanism.xoauth2:
command = SmtpAuthXOauth2Command(name, password);
break;
}
return sendCommand(command);
}