public AuthMessageSender(
     IOptionsSnapshot <IdentitySiteSettings> smtpConfig,
     IWebMailService webMailService)
 {
     _smtpConfig     = smtpConfig ?? throw new ArgumentNullException(nameof(_smtpConfig));
     _webMailService = webMailService ?? throw new ArgumentNullException(nameof(webMailService));
 }
 public WebMailServiceController(
     IWebMailService webMailService,
     IOptionsSnapshot <SmtpConfig> smtpConfig // will be provided from the `appsettings.json` file.
     )
 {
     _webMailService = webMailService;
     _smtpConfig     = smtpConfig;
 }
        public AuthMessageSender(
            IOptionsSnapshot <SiteSettings> smtpConfig,
            IWebMailService webMailService)
        {
            _smtpConfig = smtpConfig;
            _smtpConfig.CheckArgumentIsNull(nameof(_smtpConfig));

            _webMailService = webMailService;
            _webMailService.CheckArgumentIsNull(nameof(webMailService));
        }
        public WebMailServiceController(
            IWebMailService webMailService,
            IOptionsSnapshot <SmtpConfig> smtpConfig // will be provided from the `appsettings.json` file.
            )
        {
            _webMailService = webMailService;
            _smtpConfig     = smtpConfig;

            _smtpConfig = smtpConfig ?? throw new ArgumentNullException(nameof(smtpConfig));
            if (_smtpConfig.Value == null)
            {
                throw new ArgumentNullException(nameof(smtpConfig), "Please add SmtpConfig to your appsettings.json file.");
            }
        }
Exemple #5
0
        public AuthMessageSender(
            IConfiguration smtpConfig,
            IWebMailService webMailService)
        {
            _settings = smtpConfig;
            _settings.CheckArgumentIsNull(nameof(_settings));

            _webMailService = webMailService;
            _webMailService.CheckArgumentIsNull(nameof(webMailService));

            smtp = new SmtpConfig
            {
                FromAddress     = _settings["smtp:FromAddress"],
                LocalDomain     = _settings["smtp:LocalDomain"],
                FromName        = _settings["smtp:FromName"],
                Password        = _settings["smtp:Password"],
                PickupFolder    = _settings["smtp:PickupFolder"],
                UsePickupFolder = _settings.GetValue <bool>("smtp:UsePickupFolder"),
                Port            = _settings.GetValue <int>("smtp:Port"),
                Server          = _settings["smtp:Server"],
                Username        = _settings["smtp:Username"],
            };
        }