SMTP server requires a secure connection, or the client failed authentication

The SMTP server requires a secure connection, or the client failed authentication. Server response: 5.7.0. First you need to run the STARTTLS command. k12sm3795394wby.16

Description An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.

Exception Details : System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client failed authentication. Server response: 5.7.0. First you need to run the STARTTLS command. k12sm3795394wby.16

Source Error :

I use createUserWizard .. it has a distribution option in its properties that I set using the constructor (VS2010). When I used the code, it works !, but with that control it does not. I wonder why!!

Here is my web.config file:

<system.net> <mailSettings> <smtp from=" makovetskiyd@yahoo.co.uk "> <network host="smtp.gmail.com" defaultCredentials="false" port="587" userName="**********" password="*****"/> </smtp> </mailSettings> </system.net> 

But I doubt that the control uses this setting.

+6
source share
2 answers

Gmail requires you to use a secure connection. This can be installed in your web.config as follows:

 <network host="smtp.gmail.com" enableSsl="true" ... /> 
+22
source

Gmail blocks your instance of SQL Server from sending email through it. After you encounter your error, if you log in to gmail and try to compose a message, it will notify you of blocked access. You just need to tell Gmail that it was legitimate and allow future logins from sqlserver.

That should do the trick!

+5
source

Source: https://habr.com/ru/post/888817/


All Articles