I have this website with a login and a password recovery link. When I click the "forgot my password" link it takes me to a page which asks for username and security question answer. When I fill it out and hit submit. I am taken to a page that tells me the email was sent successfully but when I check my email, there is nothing there.
I'm hoping someone can tell me why I am not getting the password send to me. Here is my code.
<%@ Page Language="C#" MasterPageFile="~/BlogMasterPage.master" %>
<%@ Import Namespace="System.Net.Mail" %>
<script runat="server">
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress("xxxxxxxxxx@gmail.com", "name");
msg.To.Add(new MailAddress("xxxxxxxxx@hotmail.com", "name"));
msg.Subject = "Test Mail";
msg.Body = "It's another test, yet again!";
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;
SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = true;
smtpClient.Send(e.Message);
e.Cancel = true;
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="BlogMasterPage" runat="server">
<br />
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" OnSendingMail="PasswordRecovery1_SendingMail">
<MailDefinition
BodyFileName=""
From="xxxxxxxxxxx@gmail.com"
Subject="Password Recovery">
</MailDefinition>
</asp:PasswordRecovery>
<br />
</asp:Content>
<system.net>
<mailSettings>
<smtp from="xxxxxxxxxxxxx@gmail.com">
<network host="smtp.gmail.com" password="xxxxxxx" userName="xxxxxxxxxxxxx@gmail.com" />
</smtp>
</mailSettings>
</system.net>