FBA Recovery WebPart says "There was a problem sending email"

Mar 24, 2009 at 9:50 PM
Hello friends,

I have deployed CKS:FBA on my http://mossserver without problems, if i add the Recovery Password WebPart to the main site (Site Collection) it works perfectlly. I have a subsite http://mossserver/subsite but if i add the same webpart to this site it says "There was a problem sending email please contact with the administrator"...This sites are both in the same WebApp with the same web.config...i don`t know what is wrong...

Is possible to make this webpart working in a subsite of Site Collection?

Regards.
Mar 25, 2009 at 9:27 AM
I seem to remember having this problem when moving the wepart to a subsite.

Try changing the _ctlPasswordRecovery_SendMailError method in the webpart to:

 void _ctlPasswordRecovery_SendMailError(object sender, SendMailErrorEventArgs e)
        {
            using (SPWeb _web = SPContext.Current.Site.RootWeb)
            {
                PasswordRecovery prc = (PasswordRecovery)sender;
                MembershipUser currentUser = Membership.GetUser(prc.UserName);

                MembershipRequest membershipitem = new MembershipRequest();
                membershipitem.UserEmail = currentUser.Email;
                membershipitem.UserName = currentUser.UserName;
                membershipitem.SiteURL = _web.Url;
                membershipitem.SiteName = _web.Title;
                membershipitem.ChangePasswordURL = string.Format("{0}/{1}", _web.Url, _web.Properties[MembershipReviewSiteURL.CHANGEPASSWORDPAGE]);
                membershipitem.PasswordQuestion = currentUser.PasswordQuestion;
                membershipitem.Password = currentUser.ResetPassword(prc.Answer);

                if (!MembershipRequest.SendPasswordResetEmail(membershipitem, _web))
                {
                    prc.SuccessText = "There was an error sending the email, please check with your administrator";
                }
                e.Handled = true;
            }
        }
May 16, 2010 at 11:49 PM

http://weblogs.asp.net/paulballard/archive/2007/05/01/sharepoint-moss-2007-forms-based-authentication-login-registration-web-part.aspx

 <system.net>
    <mailSettings>
      <smtp from="Admin@sharepoint.rochester-consulting.com">
        <network host="v-win2k3" port="25" />
      </smtp>
    </mailSettings>

Was what worked for me :)