Пример #1
0
        public void Send(Contact contact)
        {
            MailMessage mail = new MailMessage(
                contact.From,
                "*****@*****.**",
                contact.Subject,
                contact.Message);
            SmtpClient client = new SmtpClient("localhost");
            client.UseDefaultCredentials = true;

            client.Send(mail);
        }
Пример #2
0
        public ActionResult Contact(ContactViewModel contactVM)
        {
            var article = _publishedArticleService.GetArticleByArticleType(5);
            ViewBag.ShowPartial = "Twitter";
            ViewBag.Message = "Contact";
            contactVM.article = article;
            if (!ModelState.IsValid)
            {
                return View(contactVM);
            }

            var contact = new Contact()
            {
                From = contactVM.From,
                Subject = contactVM.Subject,
                Message = contactVM.Message
            };

            new Email().Send(contact);

            return RedirectToAction("ContactConfirm");
        }