The SMTP server requires a secure connection or the client was not authenticated. The server respons

Опубликовано: 22 Март 2026
на канале: timeoutexpired
8,989
75

our basic code to send mail(using gmail) is
as
lets run this code & see the results

we got this error

The SMTP server requires a secure connection or
the client was not authenticated.
The server response was: 5.7.0 Authentication Required.

to solve this issue, we just need only 2 options as follows
login your gmail account(which is sending mail)
1. 2-Step Verification - make sure this is enable
2. App passwords - genrate mail password here

paste newly generated pasword in your code like in gmail pasword

and re-run code
here is the solution