Full width home advertisement

Post Page Advertisement [Top]

Send email using asp.net
Forgot Password Send ..Password Send On Email
        
 protected void Button1_Click(object sender, EventArgs e)
    {
      Bal bl= New Bal;
       bl.email_id = txtemail.Text;
       bl.forgot(bl);
       if (bl.id > 0)
       {
           MailMessage mm = new MailMessage("youremail_id", txtemail.Text);
           mm.Body = "Email: " + txtemail.Text + "Your Password Is " + bl.pass;    
           mm.IsBodyHtml = true;
           SmtpClient smtp = new SmtpClient();
           smtp.Host = "smtp.gmail.com";
           smtp.EnableSsl = true;
           System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
           NetworkCred.UserName = "youremail_id";
           NetworkCred.Password = "yourpass";
           smtp.UseDefaultCredentials = true;
           smtp.Credentials = NetworkCred;
           smtp.Port = 587;
           smtp.Send(mm);
           Label1.Text = "Password Sent Successfully on your Email id.";
       }
       else
       {
           Label1.Text = "invalid email id";
       }


Id is user id from reg table it is auto increment ...

I am using three tier architecture 

you can see my previous blog about three tier  

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib