I am using password recovery control and i am getting an error
The operation has timed out.
The web.config has the following code:
<system.net>
<mailSettings>
<smtp from="admin@mysite.com">
<network host="smtp.gmail.com" password="gmailPassword"
port="465" userName="username@gmail.com" />
</smtp>
</mailSettings>
</system.net>
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUni开发者_JS百科queEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" passwordFormat="Clear"/>
</providers>
</membership>
I have dropped the password recovery control, for automated e-mail, onto the page but it doesn't work.
What am i missing?
Tools used: asp.net 4 in VS2010
Gmail uses port 587, not 465.
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" port="587" userName="username@gmail.com" password="gmailPassword" />
</smtp>
</mailSettings>
</system.net>
It's possible because Gmail requires SSL to be enabled for SMTP.
If you are using .NET 4.0, you can add set enableSsl="true". If you are using an older version of .NET, see How to enable SSL for SmtpClient in Web.config.
精彩评论