I inherited a project that gives users the above error while trying to change their password. I stepped through and found the trouble spot, but the problem is, the values generated seem right so I don't why the error is occurring. Thanks in advance to anyone who can look at the following code and help me find out how to fix it. Let me know if more information is needed.
void EmailUser(User user) { user.ChangePasswordID = Guid.NewGuid(); user.Save(); MailMessage email = new MailMessage(); //problem line below email.From = new MailAddress(Settings.LostPasswordEmailFrom); email.To.Add(new MailAddress(uxEmail.Text)); email.Subject = Settings.LostPasswordSubject; email.Body = EmailTemplateService.HtmlMessageBody(EmailTemplates.MembershipPasswordRecovery, new { Body = Settings.LostPasswordText, BeginRequired = "", EndRequired = "", UserName = user.Name, GUID = user.ChangePasswordID.ToString() }); email.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Send(email); uxSuccessPH.Visible = true; uxQuestionPanel.Visible = false; uxUserInfoPanel.Visible = false; uxUserNameLabelSuccess.Text = uxEmail.Text; } /// <summary> /// The address that the lost password email will be sent from /// </summary> public static string LostPasswordEmailFrom { get { if (String.IsNullOrEmpty(SiteSettings.GetSettingKeyValuePair()["Media352_MembershipProvider_lostPasswordEmailFrom"])) return Globals.Settings.FromEmail; return SiteSettings.GetSettingKeyValuePair()["Media352_MembershipProvider_lostPasswordEmailFrom"]; } }