using System; using System.Data; using System.Configuration; using System.Collections; using System.Collections.Generic; 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.Data.SqlClient; using System.Globalization; using System.Net; using System.IO; using System.Xml.Linq; using System.Net.Mail; public partial class emergency : System.Web.UI.Page { string gMailAccount = "xxxxxxx@gmail.com"; string password = "xxxxxxx"; string to; string subject = "Welcome to scalabe and secure personal health records."; string message; SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["phr"]); string sta = "read",keey="null"; protected void Page_Load(object sender, EventArgs e) { } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("insert into emergency values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','"+sta+"','"+keey+"')", con); cmd.ExecuteNonQuery(); if(TextBox1.Text!=null&&TextBox2.Text!=null&&TextBox3.Text!=null) { System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(gMailAccount); message.Subject = "This is the Subject line"; message.From = new System.Net.Mail.MailAddress("yyyyyyyyyyyy@gmail.com"); message.Body = "This is the message body"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost"); smtp.Send(message); MsgBox.Show("secret key send to ur mail id"); } con.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)