public ActionResult SendMessage()
        {
            string body = "<b>Name: </b>" + Request.Form["field_name"] + "<br />" +
                          "<b>Email: </b>" + Request.Form["field_email"] + "<br />" +
                          "<b>Phone: </b>" + Request.Form["field_phone"] + "<br />" +
                          "<b>Message: </b>" + Request.Form["field_message"] + "<br />";

            try
            {
                EmailUtils.SendEmail(ConfigurationSettings.AppSettings["ContactMessageToAddress"],
                                     ConfigurationSettings.AppSettings["ContactMessageFromAddress"],
                                     "",
                                     ConfigurationSettings.AppSettings["ContactMessageBccAddress"],
                                     Request.Form["field_subject"],
                                     body,
                                     false,
                                     ""
                                     );
            }
            catch (Exception exc)
            {
                return(Json(new
                {
                    Message = "Message did not send.  Please call " + ConfigurationSettings.AppSettings["PhoneNumber"],
                    Status = "fail"
                }));
            }
            return(Json(new
            {
                Message = "Your message has been received and someone will be in contact shortly, thanks!!",
                Status = "success"
            }));
        }
Esempio n. 2
0
        public ActionResult Contact(ContactPageModel model)
        {
            if (!ReCaptcha.Validate(DataUtils.GetConfig("reCaptcha:SecretKey")))
            {
                ModelState.AddModelError("", "Captcha cannot be empty");
            }

            if (ModelState.IsValid)
            {
                EMail mail = new EMail()
                {
                    Name        = model.Name,
                    SenderEmail = model.EmailAddress,
                    Body        = model.Message,
                    ToAddress   = model.EmailAddressTo,
                    Subject     = "New message",
                    IsHtml      = true
                };

                EmailUtils.SendEmail(mail);

                return(Redirect($"/{CurrentUser.LanguageCode}/contact/confirm-contact/"));
            }
            return(CurrentUmbracoPage());
        }
Esempio n. 3
0
        public ActionResult HandleContactUs(ContactPageModel model)
        {
            if (!ReCaptcha.Validate(DataUtils.GetConfig("ReCaptcha:SecretKey")))
            {
                ModelState.AddModelError("", "Captcha cannot be empty");
            }

            if (ModelState.IsValid)
            {
                EMail mail = new EMail()
                {
                    Name        = model.Name,
                    SenderEmail = model.EmailAddress,
                    Body        = model.Message,
                    ToAddress   = SnuffoSettings.Create(model.Content).SupportEmail,
                    Subject     = model.Subject,
                    IsHtml      = true
                };

                EmailUtils.SendEmail(mail);

                return(Redirect($"/{CurrentUser.LanguageCode}/contact/submitted"));
            }

            return(CurrentUmbracoPage());
        }
Esempio n. 4
0
        public bool Execute(Task task)
        {
            TaskEmailData emailInfo = task.Parameter.DeserializeJson <TaskEmailData>();

            EmailData emailData = new EmailData()
            {
                Body        = emailInfo.Body,
                Subject     = emailInfo.Subject,
                ToAddress   = emailInfo.Email,
                FromAddress = _configuration.AppSettings["EmailFromAddress"]
            };

            return(_emailUtils.SendEmail(emailData));
        }
Esempio n. 5
0
        public static bool SendMail(string strFromDisplayName, string strReciveMail, string strSubject, string strMailBody, bool boolIsSSL, out string strResult)
        {
            EmailUtils emailUtils = new EmailUtils();

            emailUtils.FromMail     = ConfigProvider.Configs.ServMailAccount;
            emailUtils.ToMail       = strReciveMail;
            emailUtils.SmtpServer   = ConfigProvider.Configs.ServMailSMTP;
            emailUtils.MailUserName = ConfigProvider.Configs.ServMailUserName;
            emailUtils.MailPassWord = ConfigProvider.Configs.ServMailUserPwd;
            emailUtils.MailFormat   = EmailType.html;
            emailUtils.Subject      = strSubject;
            emailUtils.Body         = strMailBody;
            emailUtils.IsSSL        = ConfigProvider.Configs.ServMailIsSSL;

            if (!string.IsNullOrEmpty(strFromDisplayName))
            {
                emailUtils.FromDisplayName = ConfigProvider.Configs.SiteName;
            }
            return(emailUtils.SendEmail(out strResult));
        }
Esempio n. 6
0
        public static string InviteBOwner(string obj)
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            InvitationType       it  = new InvitationType();

            it = jss.Deserialize <InvitationType>(obj);
            Guid UserID = new Guid(HttpContext.Current.Session["UserID"].ToString());
            int  rValue = 0;

            RegistrationModel.GetRegisterDetails ObjUserInfo = RegisterManager.GetProfileDetailsByUserID(UserID);
            string strFullName              = ObjUserInfo.strFirstName + " " + ObjUserInfo.strLastName;
            string strEmailID               = it.strEmail;
            string strMailSubject           = "Be part of business contacts and grow your business!";
            Guid   OwnerInvitationID        = Guid.NewGuid();
            string RegistrationLink         = System.Configuration.ConfigurationManager.AppSettings["SiteURL"] + "/LaunchPage.aspx?InviID=" + OwnerInvitationID + "&&mid=" + UserID;
            NameValueCollection mergeFields = new NameValueCollection();

            mergeFields.Add("**REGISTRATIONURL**", RegistrationLink);
            mergeFields.Add("**ToName**", it.strName);
            mergeFields.Add("**FromName**", strFullName);
            mergeFields.Add("**FromEmail**", ObjUserInfo.strEmail);
            mergeFields.Add("**FromMobile**", ObjUserInfo.strMobile);
            ContactsModel.InviteOwner ObjOwnr = jss.Deserialize <ContactsModel.InviteOwner>(obj);
            string strMessageBody             = EmailUtils.GetMailBody("InviteByHelpdesk.html", mergeFields);
            Guid   InvitedToID = new Guid();

            EmailUtils.SendEmail(ObjUserInfo.strEmail, strEmailID, strMailSubject, strMessageBody);
            //insert query
            ObjOwnr.guidOwnerInvitationID = OwnerInvitationID;
            ObjOwnr.guidInvitedByID       = UserID;
            ObjOwnr.guidInvitedToID       = InvitedToID;
            ObjOwnr.byteMInvitationStatus = Convert.ToByte(UIEnums.MInvitationStatus.Sent);
            ObjOwnr.strEmail  = it.strEmail;
            ObjOwnr.strName   = it.strName;
            ObjOwnr.strMobile = it.strMobile;
            rValue            = ContactManager.InviteOwner(ObjOwnr);
            return(rValue.ToString());
        }
Esempio n. 7
0
        public void Test()
        {
            SendServerConfiguration sendServer = new SendServerConfiguration
            {
                IsSsl          = false,
                SmtpHost       = "smtp.163.com",
                SmtpPort       = 25,
                SenderAccount  = "*****@*****.**",
                SenderPassword = "******"
            };
            EmailBodyModel model = new EmailBodyModel
            {
                FromAddress = "*****@*****.**",
                ToAddress   = "*****@*****.**",
                Subject     = "下午会议室开会",
                IsBodyHtml  = false,
                Body        = "请各位准时参加下午15:30的会议。",
                Attachments = new List <string> {
                    @"D:\Test\注意事项.txt", @"D:\Test\会议记录模板.xlsx"
                }
            };

            EmailUtils.SendEmail(model, sendServer);
        }
        public async Task <dynamic> Post([FromBody] ReportRequest requestBody)
        {
            var itemTask = TipoQuery.QueryItem(new ObjectId(requestBody.Id), requestBody.Tipo, MongoWrapper);

            var typeName = Enum.GetName(typeof(TipoDenuncia), requestBody.Tipo);

            var emailTitle = $"[Denúncia] {typeName} - {requestBody.Motivo}";

            var emailBody = $"Uma denúncia foi realizada por um usuário da plataforma.<br>" +
                            $"<b>Motivo:</b> <pre>{requestBody.Motivo}</pre><br>" +
                            $"<b>Informações de Contato:</b> <pre>{requestBody.Contato}</pre><br>" +
                            $"<b>Tipo da Entidade:</b> <i>{typeName}</i><br>" +
                            $"<b>Dump da Entidade:</b> <pre>" +
                            $"{JsonConvert.SerializeObject(await itemTask, Formatting.Indented,new JsonConverter[] { new StringEnumConverter() })}" +
                            $"</pre><br>" +
                            $"<b></b>";

            var address = new MailAddress(SmtpConfiguration.Email, SmtpConfiguration.DisplayName, Encoding.UTF8);

            await EmailUtils.SendEmail
            (
                smtpConfig : SmtpConfiguration,
                body : emailBody,
                subject : emailTitle,
                encoding : Encoding.UTF8,
                from : address,
                to : new [] { address }
            );

            return(new ResponseBody
            {
                Code = ResponseCode.GenericSuccess,
                Message = "Denúncia enviada com sucesso!",
                Success = true,
            });
        }