using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Net.Mail;
namespace RecruitMe
{
public partial class PassAssist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlGenericControl login2 = (HtmlGenericControl)Master.FindControl("login1");
login2.Visible = false;
HtmlGenericControl lblhead2 = (HtmlGenericControl)Master.FindControl("lbls");
lblhead2.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
GridView1.DataBind();
while(GridView1.Rows.Count == 0)
{
lblError.Visible = true;
}
f1.Visible = true;
lblQ.Text = GridView1.Rows[0].Cells[3].Text;
}
protected void Button3_Click1(object sender, EventArgs e)
{
if (txtA.Text == GridView1.Rows[0].Cells[4].Text)
f2.Visible = true;
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if (RadioButton1.Checked == true)
Button4.Text = "Send";
else
Button4.Text = "Choose method";
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
if (RadioButton2.Checked == true)
Button4.Text = "Display";
else
Button4.Text = "Choose method";
}
protected void Button4_Click(object sender, EventArgs e)
{
if (Button4.Text == "Display")
{
Label5.Text = GridView1.Rows[0].Cells[2].Text;
Label5.Visible = true;
}
else if (Button4.Text == "Send")
{
if (TextBox2.Text == GridView1.Rows[0].Cells[0].Text)
{
Label6.Visible = false;
MailMessage mail = new MailMessage();
mail.To.Add(TextBox2.Text);
mail.Subject = "Your Recruit me password";
mail.Body = "Hello " + GridView1.Rows[0].Cells[1].Text + "/n" + "As requested here is your Recruit Me password below" + "/n" + "Username :" + GridView1.Rows[0].Cells[1].Text + "/n" + "Password :" + GridView1.Rows[0].Cells[2].Text;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("username", "password"); // only added my username and no the whole
[email protected] smtp.EnableSsl = true;
smtp.Port = 587;
smtp.Send(mail);
}
else
{
Label6.Visible = true;
}
}
else
{
}
}
}