Beispiel #1
0
        public JsonResult SendEmail(string Email, string Message)
        {
            Message _email      = new Message(ApplicationType.Web);
            string  defaultHtml = _email.HTML_CONFIRMATION;
            string  body        = defaultHtml
                                  .Replace("*|EMAIL_PREVIEW|*", "This is a Simple Email")
                                  .Replace("*|HEADER|*", "Simple Email Website")
                                  .Replace("*|FIRSTPARAGRAPH|*", "The message below has been customized")
                                  .Replace("*|SECONDPARAGRAPH|*", Message)
                                  .Replace("*|WEBSITE_URL|*", Request.Url.ToString())
                                  .Replace("*|WEBSITE_NAME|*", _email.WEBSITE_NAME)
                                  .Replace("*|CURRENT_YEAR|*", DateTime.Now.Year.ToString());


            KeyValuePair <bool, string> response = _email.SendMail(MessageType.Confirmation, true, body, Email);

            Response result = new Controllers.Response();

            result.Success = response.Key;

            if (response.Key)
            {
                result.Message = string.Format(_success, Email);
            }
            else
            {
                result.Message = string.Format(_failure, Email, response.Value);
            }
            string json = JsonConvert.SerializeObject(result);


            return(Json(json, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SendEmail(string Email, string Message)
        {
            Message _email = new Message(ApplicationType.Web);
            string defaultHtml = _email.HTML_CONFIRMATION;
            string body = defaultHtml
                .Replace("*|EMAIL_PREVIEW|*", "This is a Simple Email")
                .Replace("*|HEADER|*", "Simple Email Website")
                .Replace("*|FIRSTPARAGRAPH|*", "The message below has been customized")
                .Replace("*|SECONDPARAGRAPH|*", Message)
                .Replace("*|WEBSITE_URL|*", Request.Url.ToString())
                .Replace("*|WEBSITE_NAME|*", _email.WEBSITE_NAME)
                .Replace("*|CURRENT_YEAR|*", DateTime.Now.Year.ToString());


            KeyValuePair<bool, string> response = _email.SendMail(MessageType.Confirmation, true, body, Email);

            Response result = new Controllers.Response();
            result.Success = response.Key;

            if (response.Key)
                result.Message = string.Format(_success, Email);
            else {
                result.Message = string.Format(_failure, Email, response.Value);
            }
            string json = JsonConvert.SerializeObject(result);


            return Json(json, JsonRequestBehavior.AllowGet);
        }