Пример #1
0
        public ActionResult Contact(ContactUsModel model,bool captchaValid)
        {
            if (!captchaValid)
            {
                ModelState.AddModelError("", "Wrong Captcha code.");
            }

            if (ModelState.IsValid)
            {
                model.Result = true;
                ContactU entity = new ContactU();
                entity.FirstName = model.FirstName;
                entity.LastName = model.LastName;
                entity.Email = model.Email;
                entity.PhoneNo = model.PhoneNo;
                entity.Message = model.Message;
                entity.CreatedOnUtc = DateTime.UtcNow;
                _customerService.InsertContactUs(entity);

                _workflowMessageService.SendContactUsMessage(entity);
            }

            return View(model);
        }
        public int SendContactUsMessage(ContactU contactUs)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/CustomerContactUs.htm"));

            mailBody = mailBody.Replace("%contactname%", contactUs.FirstName + " " + contactUs.LastName);
            mailBody = mailBody.Replace("%phoneno%", contactUs.PhoneNo);
            mailBody = mailBody.Replace("%email%", contactUs.Email);
            mailBody = mailBody.Replace("%message%", contactUs.Message);
            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);

            var BCC = _siteSetting.BCCEmail;
            //if (!_siteSetting.SenderName.Contains("Test"))
            //{
              //  BCC = BCC + ",[email protected]";
            //}
            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, contactUs.Email, "*****@*****.**", _siteSetting.BCCEmail, mailBody, " Eric's Gutter Cleaning - Thank you for contacting us!");

            return 1;
        }
Пример #3
0
        public void InsertContactUs(ContactU contactUs)
        {
            if (contactUs == null)
                throw new ArgumentNullException("contactUs");

            _contactUsRepository.Insert(contactUs);
        }