I have a login control on my webpage along with a RecoverPassword control.
I have the following code inside of web.config
<system.net>
<mailSettings>
<smtp from="MyEmail@gmail.com">
<network host="smtp.gmail.com" password="XXXXXXX" port="587"
userName="MyEmail@gmail.com" />
</smtp>
</mailSettings>
</system.net>
The error that I keep recieving is: The SMTP server requires a secure connection or the client was not authenticated. The server respon开发者_如何学编程se was: 5.7.0 Must issue a STARTTLS command first. 35sm26203922ibs.22
Any Ideas?
TLS is connection encryption, like SSL.
In .NET 2.0 - 3.5, the smtp config doens't support enabling SSL, which sucks. You have to turn it on using the EnableSSL property of SmtpClient
I think they fixed this in 4.0. I have been using an appsetting to enable or disable SSL for smtp.
精彩评论