C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to sent Forgot Password in Mail.


Posted Date: 13 Jun 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Rumpa MMember Level: Gold    
Rating: Points: 10



The following code sample shows how to sent lost password by mail

using System.Data.SqlClient;
using System.Net.Mail;
using System.Net.Mime;

protected void Button1_Click(object sender, EventArgs e)
{
ob.get_username = TextBox1.Text;
DataSet ds = us.password_fetch();
if (ds.Tables[0].Rows.Count != 0)
{
Label1.Text = ds.Tables[0].Rows[0]["username"].ToString();
Label2.Text = ds.Tables[0].Rows[0]["password"].ToString();
Label3.Text = ds.Tables[0].Rows[0]["mailid"].ToString();
}
try
{
SmtpClient smpclient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromaddress = new MailAddress("aaa@aaa.com", "");
smpclient.Host = "photo43";
smpclient.Port = 25;
message.From = fromaddress;
message.To.Add(TextBox2.Text);
message.Subject = "Retrieve Your Password";
message.IsBodyHtml = true; ;
string body = ("username=" + Label1.Text + " " + "password=" + Label2.Text + " " + "mailid=" + Label3.Text + " ");
message.Body = body;

smpclient.Send(message);
ScriptManager.RegisterStartupScript(this, this.GetType(), "dg", "", false);
}
catch (SmtpException ex)
{

}
}
catch (Exception ex)
{ }

}




Responses

Author: Kapil Dhawan    16 Jun 2008Member Level: Gold   Points : 1
Hello,
nice piece of code
thanks for sharing your knowledge with us.
Keep posting useful code
Regards,
Kapil


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to get the directory of an executing web application
Previous Resource: Logout
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use