Example #1
0
        /// <summary>
        /// SendEmail
        /// </summary>
        /// <param name="mailMessage"></param>
        public void SendEmail(MailMessage mailMessage)
        {
            try
            {
                SetupManager setupManager = new SetupManager();
                EmailConfiguration emailConfiguration = setupManager.GetEmailConfiguration();

                SmtpClient smtp = new SmtpClient();
                smtp.UseDefaultCredentials = emailConfiguration.RequireCredentials;

                if (emailConfiguration.RequireCredentials)
                {
                    smtp.Credentials = new NetworkCredential(emailConfiguration.Username, emailConfiguration.Password);
                }

                smtp.Host = emailConfiguration.HostName;

                smtp.Port = emailConfiguration.PortNumber;

                smtp.EnableSsl = emailConfiguration.EnableSSL;

                mailMessage.From = new MailAddress(emailConfiguration.DefaultSenderEmail);
                Email email = new Email(smtp);
                email.SendEmail(mailMessage);
            }
            catch(Exception ex)
            {
                log.Error(ex.Message,ex);
            }
        }
 public void ExecuteScriptsTest()
 {
     RequestContext.Current.Add<UserContext>("UserContext", new UserContext { UserId = 1, LanguageId = 1, UserName = "******", SiteId = 1 });
     SetupManager setupManager = new SetupManager();
     setupManager.ExecuteScripts();
 }
Example #3
0
 public SetupService()
 {
     _setupManager = new SetupManager();
 }