Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data.SqlClient;
- using System.Data;
- using System.Net.Mail;
- namespace Sonex.WebFrom
- {
- public partial class Customr_Confrm : System.Web.UI.Page
- {
- SqlConnection con;
- myDb db = new myDb();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Application["TotalPrice"] == null)
- {
- Response.Redirect("Coustomer_Home_page.aspx");
- }
- else
- TextBoxtotalprice.Text = Application["TotalPrice"].ToString();
- txtquatnity.Text = Application["Quanity"].ToString();
- }
- //send data to gmail
- protected void Button1_Click(object sender, EventArgs e)
- {
- Application.Clear();
- con = db.createConnection("Sonex");
- con = db.connectionOpen(con);
- Msg.Body = " Date= n n" + TextBoxDate.Text + Environment.NewLine + " NAME= n" + TextBoxfname.Text + TextBoxDate.Text + Environment.NewLine + " City= n" + TextBoxcity.Text + TextBoxDate.Text + Environment.NewLine + " Postal= n" + TextBoxPostal.Text + TextBoxDate.Text + Environment.NewLine + " PhoneNumber= n" + TextBoxPhonenum.Text + TextBoxDate.Text + Environment.NewLine + " Addres= n" + TextBoxAddres.Text + TextBoxDate.Text + Environment.NewLine + " Email= n" + TextBoxemai.Text + TextBoxDate.Text + Environment.NewLine + " TOtoal Quantity= n" + txtquatnity.Text + TextBoxDate.Text + Environment.NewLine + " TotalPrice= n" + TextBoxtotalprice.Text;
- Msg.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "smtp.gmail.com";
- System.Net.NetworkCredential Networkcred = new System.Net.NetworkCredential();
- Networkcred.UserName = "mno75@gmail.com";
- Networkcred.Password = "**********";
- smtp.UseDefaultCredentials = true;
- smtp.Credentials = Networkcred;
- smtp.Port = 587;
- smtp.EnableSsl = true;
- smtp.Send(Msg);
- Label1.Text = "Email has been Send........";
- Label2.Text = "Data Successfully Inserted";
- }
- else
- Label1.Text = "try agin";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement