// 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>(); }
public MailSender(SMTPMailConfig smtpConfig, ILogger <MailSender <T> > logger, ViewRenderService renderer) { _smtpConfig = smtpConfig; _logger = logger; _renderer = renderer; }