Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var smtpConfig = new SMTPMailConfig
            {
                Host      = Configuration["SANTA_SMTP_HOST"],
                Port      = int.Parse(Configuration["SANTA_SMTP_PORT"]),
                FromEmail = Configuration["SANTA_SMTP_FROM_EMAIL"],
                UserName  = Configuration["SANTA_SMTP_USER_NAME"],
                Password  = Configuration["SANTA_SMTP_PASSWORD"],
                UseTLS    = bool.Parse(Configuration["SANTA_SMTP_USE_TLS"])
            };

            services.AddSingleton(smtpConfig);
            services.AddControllersWithViews();
            services.AddRazorPages();
            services.AddHttpContextAccessor();
            services.AddSingleton <MailSender <Participant> >();
            services.AddControllersWithViews();
            services.AddSingleton <ViewRenderService>();
            services.AddSingleton <Sender>();
        }
Example #2
0
 public MailSender(SMTPMailConfig smtpConfig, ILogger <MailSender <T> > logger, ViewRenderService renderer)
 {
     _smtpConfig = smtpConfig;
     _logger     = logger;
     _renderer   = renderer;
 }