views:

35

answers:

1

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="[email protected]">
        <network host="smtp.gmail.com" password="XXXXXXX" port="587"
         userName="[email protected]" />
      </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 response was: 5.7.0 Must issue a STARTTLS command first. 35sm26203922ibs.22

Any Ideas?

+2  A: 

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.

BC