コード例 #1
0
        public ActionResult SendContact(ContactFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return CurrentUmbracoPage();
            }

            //Set the fields that need to be replaced.
            var formFields = new Dictionary<string, string>
            {
                {"Name", model.Name},
                {"Email", model.Email},
                {"Comment", model.Comment}
            };

            //Send the e-mail with the filled in form data.
            ProcessForms(formFields, EmailType.Contact, "emailUser", "emailCompany");

            //Redirect to the succes page.
            var child = CurrentPage.Children.FirstOrDefault();
            if (child != null)
            {
                return RedirectToUmbracoPage(child);
            }

            return RedirectToCurrentUmbracoPage();
        }
        public ActionResult SendContact(ContactFormModel model)
        {
            var contact = CurrentPage as Contact;

            //Set the fields that need to be replaced.
            var formFields = new Dictionary<string, string> 
            {
                {"Name", model.Name},
                {"Email", model.Email},
                {"Phone", model.Phone},
                {"Message", model.Message}
            };

            //Send the e-mail with the filled in form data.
            Umbraco.ProcessForms(formFields, contact.Email, EmailType.Contact);

            //Redirect to the succes page.
            var child = CurrentPage.Children.FirstOrDefault();
            if (child != null)
            {
                return RedirectToUmbracoPage(child);
            }

            return RedirectToCurrentUmbracoPage();

        }