Advertisement
Guest User

Untitled

a guest
Aug 11th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Web;
  4. using System.Web.UI;
  5. using System.Web.UI.WebControls;
  6. using System.Data.SqlClient;
  7. using System.Data;
  8. using System.Net.Mail;
  9.  
  10.  
  11. namespace Sonex.WebFrom
  12. {
  13. public partial class Customr_Confrm : System.Web.UI.Page
  14. {
  15. SqlConnection con;
  16. myDb db = new myDb();
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. if (Application["TotalPrice"] == null)
  20. {
  21. Response.Redirect("Coustomer_Home_page.aspx");
  22. }
  23. else
  24. TextBoxtotalprice.Text = Application["TotalPrice"].ToString();
  25. txtquatnity.Text = Application["Quanity"].ToString();
  26. }
  27. //send data to gmail
  28. protected void Button1_Click(object sender, EventArgs e)
  29. {
  30. Application.Clear();
  31. con = db.createConnection("Sonex");
  32. con = db.connectionOpen(con);
  33.  
  34. 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;
  35. Msg.IsBodyHtml = true;
  36.  
  37. SmtpClient smtp = new SmtpClient();
  38. smtp.Host = "smtp.gmail.com";
  39. System.Net.NetworkCredential Networkcred = new System.Net.NetworkCredential();
  40. Networkcred.UserName = "mno75@gmail.com";
  41. Networkcred.Password = "**********";
  42. smtp.UseDefaultCredentials = true;
  43. smtp.Credentials = Networkcred;
  44. smtp.Port = 587;
  45. smtp.EnableSsl = true;
  46. smtp.Send(Msg);
  47. Label1.Text = "Email has been Send........";
  48. Label2.Text = "Data Successfully Inserted";
  49. }
  50. else
  51. Label1.Text = "try agin";
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement