Example #1
0
        /// <summary>
        /// Retrieve configurations for sending an automated e-mail
        /// </summary>
        /// <param name="config">config from appsettings.json file</param>
        /// <returns></returns>
        public static SendEmailConfiguration GetEmailConfiguration(IConfiguration config)
        {
            SendEmailConfiguration emailConfiguration = new SendEmailConfiguration()
            {
                SmtpServer = config.GetSection("EmailSettings:SmtpServer").Value,
                SmtpPort   = Int32.Parse(config.GetSection("EmailSettings:SmtpPort").Value.ToString()),
                SmtpUseSsl = bool.Parse(config.GetSection("EmailSettings:SmtpUseSsl").Value.ToString()),
                SmtpRequireAuthentication = bool.Parse(config.GetSection("EmailSettings:SmtpRequireAuthentication").Value.ToString()),
                SmtpUsername = config.GetSection("EmailSettings:SmtpUserName").Value,
                SmtpPassword = config.GetSection("EmailSettings:SmtpPassword").Value
            };

            return(emailConfiguration);
        }
Example #2
0
 public SendEmailService(SendEmailConfiguration configuration)
 {
     this.configuration = configuration;
 }