I have an ASP PasswordRecovery module on a page, the code comes up like this:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
<MailDefinition From="[email]">
</MailDefinition>
</asp:PasswordRecovery>
However, when I submit the form I just get the message, “We were unable to access your information. Please try again.”
I saw this question and made sure to add those attributes to my web.config here:
<providers>
<remove name="CustomizedMembershipProvider"/>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MessageBank"
applicationName="MessageBank"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
enablePasswordReset="true"
enablePasswordRetrieval="false" />
</providers>
The email is working fine because the app sends emails regularly throughout the day. But it’s not sending recovery emails for some reason.
Here’s the relevant web.config section:
<mailSettings>
<smtp from="[email]">
<network host="[host]" password="[password]" userName="[username]"/>
</smtp>
</mailSettings>
UPDATE: I added a function to handle the “SendingMail” event:
Protected Sub PasswordRecovery_submit(ByVal sender As Object, ByVal e As WebControls.MailMessageEventArgs) Handles PasswordRecovery.SendingMail
I added a break point in this function but it is never reached, the above error message just comes up in the app. Any other ways to debug what’s going wrong?
Here is how I solved the problem. As mentioned in the comments on Brian’s answer, our app is using a custom email function (not 100% sure why but the regular SMTP stuff just doesn’t work). Anyway, you can simply hijack the
PasswordRecovery.SendingMailevent: