Exemplo n.º 1
0
        public static void Notify(FeedbackForm feedbackForm)
        {
            string[] mailTo = ConfigurationManager.AppSettings["mailTo"].Split(new[] { " ", ";", "," }, StringSplitOptions.RemoveEmptyEntries);
            SmtpClient client = new SmtpClient();
            MailMessage message = new MailMessage();
            foreach (var mailAddress in mailTo)
            {
                message.To.Add(mailAddress);
            }
            message.Subject = "active-land форма обратной связи";
            message.Body =
                string.Format(
                    "<div><div>Имя: {0}</div><div>Телефон: {1}</div><div>Email: {2}</div><div>Сообщение: {3}</div>",
                    feedbackForm.Name,
                    feedbackForm.Phone,
                    feedbackForm.Email,
                    feedbackForm.Question);
            message.IsBodyHtml = true;
//#if !DEBUG
            client.Send(message);
//#endif
            message.Dispose();
        }
Exemplo n.º 2
0
        public ActionResult Feedback(FormCollection form)
        {
            var contentName = form["contentName"];


            var feedbackForm = new FeedbackForm
            {
                Name = form["customerName"],
                Phone = form["mobilePhone"],
                Email = form["email"],
                Question = form["question"]
            };

            MailHelper.Notify(feedbackForm);

            if (string.IsNullOrEmpty(contentName))
            {
                return RedirectToAction("ProductDetails", new { product = form["productName"], msg = "thanks" });
            }
            return RedirectToAction("Index", new { id = contentName, msg="thanks" });
        }