This error occurs when you connect to the SMTP server using an invalid port, protocol (SSL or TLS), or if your sender account does not support SMTP authentication.
You can try the actions below to resolve the error.
1. Using the correct port and protocol
Most SMTP servers do not accept port 465 (SSL) as it is a deprecated port for email sending. Many SMTP servers accept port - 587 via TLS. So ensure that you are trying to connect to the server using the correct port (as specified in their documentation). Hence, make sure that you specify "TLS" (or "SLS" based on the port you use) as the SMTP protocol.
2. Enable SMTP authentication
Ensure that you have enabled SMTP authentication for your email sending account. For example, if you use Google SMTP servers to send emails, ensure that you have turned on "Less Secure Sign In Technology" to allow your Python script to authenticate with the Google SMTP server.
View all errors