コード例 #1
0
        public ActionResult Contact(ContactVM contactVM)
        {
            if (ModelState.IsValid)
            {
                var sb = new StringBuilder();
                sb.AppendFormat("<p>Nieuw contact</p>");
                sb.AppendFormat("<p>Naam: {0}</p>", contactVM.Name);
                sb.AppendFormat("<p>E-mail: {0}</p>", contactVM.Email);
                sb.AppendFormat("<p>Telefoon: {0}</p>", contactVM.PhoneNumber);
                sb.AppendFormat("<p>Boodschap:<br /> {0}</p>", contactVM.Message);

                try
                {
                    SendMail("*****@*****.**", ConfigurationSettings.AppSettings["ContactAddress"], "Nieuwe contactaanvraag Oldlima", sb.ToString(), true);

                    TempData["InfoMessage"] = "Bedankt voor je bericht, we contacteren je zo snel mogelijk.";
                }
                catch (SmtpException smtpEx)
                {
                    TempData["ErrorMessage"] = "Er is een fout gebeurd. Probeer het later nogmaals opnieuw aub.";
                    LogHelper.Error(MethodBase.GetCurrentMethod().DeclaringType, "Error occured while sending mail", smtpEx);
                }

                return RedirectToCurrentUmbracoPage();
            }
            return CurrentUmbracoPage();
        }
コード例 #2
0
        public ActionResult Contact()
        {
            var model = new ContactVM();

            return PartialView("ContactForm", model);
        }