Click here to Skip to main content
15,914,444 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
how to write code for send email and forget password

for example i forget password, once click that forget password button or link and apply the asking details and will get the details through email how it is possible please reply me step by step
Posted
Comments
JoCodes 22-Jan-14 23:47pm    
Have you tried to use google for the same?
member1431 22-Jan-14 23:59pm    
thanks vamsi krishna for your reply
JoCodes 23-Jan-14 0:16am    
You are Welcome

C#
//sending Email.
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.To.Add(TextBox1.Text);//Read user email id here
                msg.Subject = "Forgot password.";
                msg.From = new System.Net.Mail.MailAddress("autoemail@xyz.com");
                string passwrd="  "; //retrieve the password from database and assign it to password string.
                msg.Body += "Your user ID is " + TextBox1.Text+" and password is +"passwrd;
                msg.Body += "Have a great day!\n";
                msg.Body += "  \n  ";
                msg.Body += "-Team\n XYZ services!";

                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("localhost");//replace the localhost with hosting server name.For example in case of godaddy it is "relay-hosting.secureserver.net"
                smtp.Send(msg);


Happy coding.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900