When authenticating with an SMTP server using either the Authenticate method in the .NET class or ActiveX control, or when calling the SmtpAuthenticate function in the library API, the attempt fails with an error indicating an invalid or unsupported authentication protocol was specified.
This error is indicated with the error code 12226, returned by the LastsError property in the .NET class or ActiveX control. If you are using the Library Edition API, or the error code 0x80042FC2 is returned by the SmtpGetLastError function.
This error can occur when you attempt to authenticate the SMTP client session, but the connection itself is not secure. Although the server may accept a non-secure connection, it will reject requests to authenticate the client because it would reveal the user credentials.
Most mail servers today are configured to require all authentication to be performed using a secure connection, and many will only allow the connection if TLS 1.2 or later is used as the security protocol.
If you are using the .NET class or ActiveX control, make sure your application has set the Secure property to True prior to calling the Connect method. Alternatively, you can call the Connect method with options arguments which specify the connection should be secure.
If you are using the library API or C++ class, make sure you call the SmtpConnect function or the SmtpClient::Connect method with the SMTP_OPTION_SECURE option. By default, SocketTools will only use TLS 1.2 as the default protocol version and will select the most secure cipher suite available on the system.
This article refers to the components in SocketTools 10 and subsequent versions. SocketTools 9 and previous versions will negotiate secure connections using TLS 1.0 as a supported protocol and this may cause some modern mail servers to reject the connection attempt.
By default, the current version of SocketTools will only use TLS 1.2 (or later) when establishing a secure connection. If your application is connecting to a legacy mail server which only supports TLS 1.0, you can specify this using a compatibility option.
Support for OAuth 2.0 is only available with the current version of SocketTools. This authentication option is not available in previous versions.