problem with password recovery control
Hello,
Having typed the code out about tha passsword recovery control and I get the following error.
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. 14sm672265ewy.3
please any help i will be faithful..
my code as follows in aspx file:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" OnSendingMail="PasswordRecovery1_SendingMail" >
<MailDefinition BodyFileName="~/EmailTemplate/PasswordRecovery.txt"
Subject="your password has been reset..." From="temn.cis.just@gmail.com"
Priority="High">
the code that i include it in the web config:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="myUserName@gmail.com ">
<network host="smtp.gmail.com" port="587" userName="MyUserNamer@gmail.com" password="Mypassword" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
and the code that included in the aspx.cs file is:
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
SmtpClient mySmtpClient = new SmtpClient();
myMessage.To.Add(new MailAddress("MyUserName@gmail.com"));
mySmtpClient.Port = 587;
mySmtpClient.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com ", "MyPassword");
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(myMessage);
}
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
the text that i include it in the PasswordRecovery.txt is:
Your password has been reset, <%UserName%>!
According to our records, you have requested that your password be reset.
Your new password is: <%Password%>
If you have any questions or trouble logging on please contact a site administrator.
Thank you!
to give that user random password and user name to get log in again....
cheers
i will be faithful please any help i need it
ghader
|