• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1138
  • Last Modified:

ASP.net password recovery - sending email

This can't be that hard. I've been looking at examples and still can't get password recovery working. I get

"Your attempt to retrieve your password was not successful. Please try again. "

This is what I have

<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" onsendingmail="PasswordRecovery1_SendingMail"  >
          <asp:TextBox ID="UserName" CssClass="textbox" runat="server"></asp:TextBox>
       <asp:Button ID="SubmitButton" runat="server" OnClick="test" CommandName="Submit" CssClass="signin_submit" Text="Submit" ValidationGroup="PasswordRecovery1" />


  protected void test(object sender, EventArgs e)
        string userid = string.Empty;
            var membershipUser = Membership.GetUser(PasswordRecovery1.UserName);
            if (membershipUser != null)
                userid = membershipUser.Email;
            PasswordRecovery1.MailDefinition.From = ConfigurationManager.AppSettings["BDFrom"];
            PasswordRecovery1.MailDefinition.Subject = "Password Recovery email";

        catch (Exception ex)


////********and in webconfig

			<smtp from="">
				<network host="myhost" password="pwd" userName="uname"/>

Open in new window

2 Solutions
Johny BravoCommented:
Please check your web.config settings.

You can refer,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now