Ejemplo n.º 1
0
        public bool SendWelcomeEmail(string email, string subject, string body)
        {
            var mailSettings = EmailBase.GetNotificationSettings();

            if (mailSettings != null)
            {
                var emailMessage = new Welcome();
                emailMessage.From    = mailSettings.From;
                emailMessage.To      = email;
                emailMessage.Subject = subject;
                emailMessage.Header  = mailSettings.MailHeader.ToString();
                emailMessage.Footer  = mailSettings.MailFooter.ToString();
                emailMessage.Body    = body;
                var result = EmailBase.SendEmail(emailMessage, Log);
                if (result.Success)
                {
                    return(true);
                }
                else
                {
                    Log.Error(result.Exception.Message, result.Exception);
                    return(false);
                }
            }
            Log.Error("Unable to get notification settings");
            return(false);
        }
Ejemplo n.º 2
0
        public bool SendOrderReceipt(PurchaseOrder order)
        {
            var mailSettings = EmailBase.GetNotificationSettings();

            if (mailSettings != null)
            {
                var emailMessage = new Receipt(order);
                emailMessage.From   = mailSettings.From;
                emailMessage.Header = mailSettings.MailHeader.ToString();
                emailMessage.Footer = mailSettings.MailFooter.ToString();

                var result = EmailBase.SendEmail(emailMessage);
                if (result.Success)
                {
                    return(true);
                }
                else
                {
                    Log.Error(result.Exception.Message, result.Exception);
                    return(false);
                }
            }
            Log.Error("Unable to get notification settings");
            return(false);
        }
Ejemplo n.º 3
0
        public bool SendResetPasswordEmail(string email, string subject, string body, string passwordHash, string resetUrl)
        {
            var mailSettings = EmailBase.GetNotificationSettings();

            if (mailSettings != null)
            {
                var emailMessage = new Models.ResetPassword();
                emailMessage.From     = mailSettings.From;
                emailMessage.To       = email;
                emailMessage.Subject  = subject;
                emailMessage.Header   = mailSettings.MailHeader.ToString();
                emailMessage.Footer   = mailSettings.MailFooter.ToString();
                emailMessage.Body     = body;
                emailMessage.Token    = passwordHash;
                emailMessage.ResetUrl = resetUrl;
                var result = EmailBase.SendEmail(emailMessage, Log);
                if (result.Success)
                {
                    return(true);
                }
                else
                {
                    Log.Error(result.Exception.Message, result.Exception);
                    return(false);
                }
            }
            Log.Error("Unable to get notification settings");
            return(false);
        }
 public NewsletterViewModel(NewsletterPage currentPage)
     : this(currentPage, EmailBase.GetNotificationSettings())
 {
 }