public static IServiceCollection AddEmailErrorNotifier(this IServiceCollection services, Action <EmailErrorNotifierOptions> options) { services.AddScoped <IErrorNotifier, EmailErrorNotifier>(); services.AddScoped <EmailErrorNotifierOptions>((s) => { var opts = new EmailErrorNotifierOptions(); options(opts); return(opts); }); return(services); }
public EmailErrorNotifier(SmtpClient mailClient, IUserMembership membership, EmailErrorNotifierOptions options) { _mailClient = mailClient; _membership = membership; _options = options; }