protected void btnSubmit_Click(object sender, EventArgs e) { string email = txtEmail.Text.Trim(); string subject = txtSubject.Text.Trim(); if (email.Length > 0 && subject.Length > 0) { ContactUsInfoDto contactUsInfo = new ContactUsInfoDto(); contactUsInfo.Email = email; contactUsInfo.Subject = subject; contactUsInfo.Name = txtName.Text.Trim(); contactUsInfo.Phone = txtPhone.Text.Trim(); contactUsInfo.Address = txtAddress.Text.Trim(); contactUsInfo.Message = txtMessage.Text.Trim(); contactUsInfo.IssuedTime = DateTime.Now; try { NotificationProcessor.SendContactUs(contactUsInfo); lbResultMsg.Text = Localize("Shop.ContactUsPage.lbResultMsg", "Thank you for contacting us! Your message has been sent to our support team."); ClearForm(); } catch (Exception ex) { ProcException(ex, "Sending email failed. "); } } }
public static void SendContactUs(ContactUsInfoDto contactUsInfo) { if (WebContext.Current.EmailSender != null) { NotificationFactory factory = new NotificationFactory(WebContext.Current.EmailSender); ContactUsNotificationBuilder builder = new ContactUsNotificationBuilder(contactUsInfo, WebContext.Current.ContactUsTemplate); factory.Send(builder); } }
public ContactUsNotificationBuilder(ContactUsInfoDto contactUsInfo, NotificationTemplateData template) { ContactUsInfo = contactUsInfo; Template = template; }