protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            objStudent.EmailIDforForgetPass = txt_email.Text.Trim();
            DataSet ds = objStudent.ForgotPasswordStd();

            if (ds.Tables[0].Rows.Count > 0)
            {
                //string gmailusername = "******";
                //string gmailpassword = "******";
                MailMessage Msg = new MailMessage();
                // Sender e-mail address.
                Msg.From = new MailAddress("*****@*****.**");
                // Recipient e-mail address.
                Msg.To.Add(txt_email.Text);
                Msg.Subject    = "FYP Services| Your Password Detail's";
                Msg.Body       = "<br />Hi " + ds.Tables[0].Rows[0]["Std_Name"] + ", <br/>Please check your Login Detail's<br/><br/>Your Registration ID: " + ds.Tables[0].Rows[0]["UserName"] + "<br/>Your Password: "******"Password"] + "<br/>";
                Msg.IsBodyHtml = true;
                // your remote SMTP server IP.
                SmtpClient smtp = new SmtpClient();
                smtp.UseDefaultCredentials   = true;
                smtp.DeliveryMethod          = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                smtp.PickupDirectoryLocation = "C:/Users/Majid/Documents/Visual Studio 2010/WebSites/FYP/uploads/";
                //smtp.Host = "smtp.yahoo.com";
                //smtp.Port = 465;
                //smtp.EnableSsl = true;
                //smtp.UseDefaultCredentials = false;
                //smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                //smtp.Credentials = new System.Net.NetworkCredential(gmailusername, gmailpassword);
                smtp.Send(Msg);
                //Msg = null;
                ImagePreview.Width    = 60;
                ImagePreview.Height   = 94;
                ImagePreview.ImageUrl = "~/Images/goodidea.gif";
                ImagePreview.Visible  = true;
                lblMsg.ForeColor      = System.Drawing.Color.Green;
                lblMsg.Text           = "Your Password Details is Sent to your Email ID..";
                // Clear the textbox valuess
                txt_email.Text = "";
            }
            else
            {
                ImagePreview.ImageUrl = "~/Images/oops.gif";
                ImagePreview.Visible  = true;
                lblMsg.Text           = "The Email ID you entered is not exists.";
                lblMsg.ForeColor      = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {
            ImagePreview.ImageUrl = "~/Images/oops.gif";
            ImagePreview.Visible  = true;
            lblMsg.Text           = ex.Message;
            lblMsg.ForeColor      = System.Drawing.Color.Red;
        }
    }