public ActionResult Contacts(Nop.Web.Areas.MiniSite.Models.Common.ContactUsModel model, bool captchaValid = true) { if (ModelState.IsValid) { string email = model.Email.Trim(); string fullName = model.FullName; string StoreName = _workContext.CurrentMiniSite.MiniSiteLayout.RootTitle; string subject = string.Format(_localizationService.GetResource("ContactUs.EmailSubject"), StoreName); var emailAccount = _emailAccountService.GetEmailAccountById(_emailAccountSettings.DefaultEmailAccountId); if (emailAccount == null) { emailAccount = _emailAccountService.GetAllEmailAccounts().FirstOrDefault(); } string from = null; string fromName = null; string body = Core.Html.HtmlHelper.FormatText(model.Enquiry, false, true, false, false, false, false); //required for some SMTP servers if (_commonSettings.UseSystemEmailForContactUsForm) { from = emailAccount.Email; fromName = emailAccount.DisplayName; body = string.Format("<strong>From</strong>: {0} - {1}<br />Company: {3} <br /><br />{2}", Server.HtmlEncode(fullName), Server.HtmlEncode(email), body, model.Company); } else { from = email; fromName = fullName; } _queuedEmailService.InsertQueuedEmail(new QueuedEmail() { From = from, FromName = fromName, To = _workContext.CurrentMiniSite.ContactEmail ?? _workContext.CurrentMiniSite.Customer.Email, ToName = _workContext.CurrentMiniSite.Customer.Username, Priority = 5, Subject = subject, Body = body, CreatedOnUtc = DateTime.UtcNow, EmailAccountId = emailAccount.Id }); model.SuccessfullySent = true; model.Result = _localizationService.GetResource("ContactUs.YourEnquiryHasBeenSent"); model.Company = null; model.Email = null; model.Enquiry = null; model.FullName = null; //activity log return(View("Contacts", model)); } return(View("Contacts", model)); }
public ActionResult Contacts() { var model = new Nop.Web.Areas.MiniSite.Models.Common.ContactUsModel() { Email = null, Company = null, DisplayCaptcha = false }; return(View(model)); }