Blessy Baby Digitalmesh Softech pvt Ltd https://blessybaby.wordpress.com/
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 = "hostname"; 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) { } }
Thanks & Regards, Software Engineer, Pradeep Kumar
Login to post response