Sends the AUTH PLAIN command.
AUTH is actually the name of the SMTP command; PLAIN is the name of a registered SASL authentication mechanism, which is supplied as a parameter to the AUTH command. (SASL, described in RFC 2222, means "Simple Authentication and Security Layer".) The PLAIN authentication mechanism is described in RFC 2595.
PLAIN is the least secure of all the SASL authentication mechanisms, since the password is essentially sent unencrypted across the network. The CRAM-MD5 authentication mechanism is much more secure. You can use the AuthCramMd5 method to send the AUTH CRAM-MD5 command.
The AuthPlain method takes a user name and password
as parameters.
After the method returns, you should check the server's reply code, available as the ReplyCode property. A 235 reply code indicates success.
| Exception Type | Condition |
|---|---|
| Exception | If a network or protocol error occurs. |
SmtpClient Class | Hunny.Mail Namespace | SmtpClient.AuthCramMd5 method | SMTP Service Extension for Authentication | Simple Authentication and Security Layer (SASL)