public Emailer(CustomerContact ourContact) { Name = ourContact.Name; Email = ourContact.Email; Phone = ourContact.Phone; Comment = ourContact.Comment; TimeStamp = ourContact.TimeStamp; }
protected void Button1_Click(object sender, EventArgs e) { CustomerContact ourContact = new CustomerContact(); // store all fields from the form ourContact.Name = Name.Text; ourContact.Email = Email.Text; ourContact.Phone = Phone.Text; ourContact.Comment = Comment.Text; ourContact.TimeStamp = DateTime.Now; // store in session for later retrieval Session["CurrentContact"] = ourContact; // start a new email object Emailer ourEmailer = new Emailer(ourContact); // send email ourEmailer.sendEmail(); // redirect to thank you page Response.Redirect("ThankYou.aspx"); }