Esempio n. 1
0
        public override sealed void OnVirtualWork()
        {
            PostageAppMessage = Execute();

            PostageAppClient = new PostageAppClient()
            {
                TemplateName = PostageAppMessage.TemplateName
            };

            if (PostageAppMessage.GlobalVariables != null)
            {
                if (PostageAppMessage.GlobalVariables.Count > 0)
                    PostageAppClient.GlobalVariables.AddRange(PostageAppMessage.GlobalVariables);
            }

            if (PostageAppMessage.Attachments != null)
            {
                if (PostageAppMessage.Attachments.Count > 0)
                    PostageAppClient.Attachments.AddRange(PostageAppMessage.Attachments);
            }

            PostageAppClient.Recipients.AddRange(PostageAppMessage.Recipients);
            Response = Send();

            OnMessageSent();
        }
Esempio n. 2
0
        private void SendNotificationEmail(string message)
        {
            var templateName = "exception_report";

            var exceptionRecipients = ReadConfig.CommonCloudCoreApplicationSettings.ExceptionRecipients;
            var recipients = new List<EmailRecipient>();
            for (int index = 0; index < exceptionRecipients.Count; index++)
            {
                recipients.Add(new EmailRecipient() { RecipientEmail = exceptionRecipients[index].RecipientAddress });
            }

            if (recipients.Any())
            {
                var globalVariables = new Dictionary<string, string>
                {
                    { "exceptioncontent", message.Replace("\n", "<br />") },
                    { "subject", "Exception Report" },
                };

                var postageAppClient = new PostageAppClient()
                {
                    TemplateName = templateName,
                    GlobalVariables = globalVariables.ToList(),
                    Recipients = recipients
                };

                postageAppClient.Send();
            }
        }
Esempio n. 3
0
        internal void RequestResetPassword(UrlHelper url)
        {
   
            Guid? passwordResetReferenceGuid = null;
            CloudCoreDB.Context.Cloudcore_UserResetPasswordRequest(UserName, ref passwordResetReferenceGuid);

            var mailMan = new PostageAppClient();

            if (passwordResetReferenceGuid != null)
            {
                var response = mailMan.SendResetPasswordEmail(UserName, HttpContext.Current.Request.Url.Scheme,
                    HttpContext.Current.Request.Url.Authority, passwordResetReferenceGuid.Value);

                if (!response.ApiSuccessfullyCalled)
                    throw new Exception("An error occured while trying to send email.");
            }
        }
 public void ResetPassword([FromBody]ResetPassword data)
 {
     Guid? passwordResetReferenceGuid = null;
     CloudCoreDB.Context.Cloudcore_UserResetPasswordRequest(data.LoginOrEmail, ref passwordResetReferenceGuid);
     var mailMan = new PostageAppClient();
     mailMan.SendResetPasswordEmail(data.LoginOrEmail, Request.RequestUri.Scheme, Request.RequestUri.Authority, passwordResetReferenceGuid.Value);
 }
Esempio n. 5
0
        private void RequestPasswordReset(UserContextModel model)
        {
            var passwordResetReferenceGuid = model.GetPasswordResetGuid();

            var mailMan = new PostageAppClient();
            mailMan.SendResetPasswordEmail(
                model.Email,
                HttpContext.Request.Url.Scheme,
                HttpContext.Request.Url.Authority,
                passwordResetReferenceGuid);
        }