/// <summary> /// Register a SendGrid mailer with the factory /// </summary> /// <param name="factory">The factory.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The history store.</param> public static void AddSendGridMailer( this MailerFactory factory, SendGridMailerSettings mailerSettings, ILogger <SendGridMailer> logger = null, IHistoryStore store = null) { factory.Register(() => new SendGridMailer( mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <SendGridMailer>(), factory.ConfigureHistoryStoreLogger(store))); }
/// <summary> /// Registers a null mailer with the factory. /// </summary> /// <param name="factory">The factory.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The store.</param> public static void AddNullMailer ( this MailerFactory factory, NullMailerSettings mailerSettings, ILogger <NullMailer> logger = null, IHistoryStore store = null ) { factory.Register <NullMailer, NullMailerSettings>(mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <NullMailer>(), factory.ConfigureHistoryStoreLogger(store)); }
/// <summary> /// Register a MailKit mailer with the factory. /// </summary> /// <param name="factory">The factory.</param> /// <param name="clientFunc">The client function.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The history store.</param> public static void AddMkSmtpMailer( this MailerFactory factory, Func <SmtpClient> clientFunc, MkSmtpMailerSettings mailerSettings, ILogger <MkSmtpMailer> logger = null, IHistoryStore store = null) { factory.Register(() => new MkSmtpMailer( clientFunc(), mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <MkSmtpMailer>(), factory.ConfigureHistoryStoreLogger(store))); }
/// <summary> /// Registers a safety mailer proxy for a MailKit mailer. /// </summary> /// <param name="factory">The factory.</param> /// <param name="safetyMailerSettings">The safety mailer settings.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The history store.</param> public static void AddSafetyMailer( this MailerFactory factory, SafetyMailerSettings safetyMailerSettings, MkSmtpMailerSettings mailerSettings, ILogger <MkSmtpMailer> logger = null, IHistoryStore store = null) { factory.Register(() => new SafetyMailer <MkSmtpMailer>( new MkSmtpMailer ( mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <MkSmtpMailer>(), factory.ConfigureHistoryStoreLogger(store) ), safetyMailerSettings)); }
/// <summary> /// Registers a safety mailer proxy for the specified mailer type. /// </summary> /// <typeparam name="TMailer">The type of the t mailer.</typeparam> /// <typeparam name="TMailerSettings">The type of the t mailer settings.</typeparam> /// <param name="factory">The factory.</param> /// <param name="safetyMailerSettings">The safety mailer settings.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The store.</param> public static void AddSafetyMailer <TMailer, TMailerSettings> ( this MailerFactory factory, SafetyMailerSettings safetyMailerSettings, TMailerSettings mailerSettings, ILogger <NullMailer> logger = null, IHistoryStore store = null ) where TMailer : class, IMailer <TMailerSettings> where TMailerSettings : class, IMailerSettings { factory.Register <SafetyMailer <TMailer>, SafetyMailerSettings, TMailer, TMailerSettings>( safetyMailerSettings, mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <NullMailer>(), factory.ConfigureHistoryStoreLogger(store)); }
/// <summary> /// Registers a safety mailer proxy for a SendGridMailer. /// </summary> /// <param name="factory">The factory.</param> /// <param name="safetyMailerSettings">The safety mailer settings.</param> /// <param name="clientFunc">The client function.</param> /// <param name="mailerSettings">The mailer settings.</param> /// <param name="logger">The logger.</param> /// <param name="store">The store.</param> public static void AddSafetyMailer ( this MailerFactory factory, SafetyMailerSettings safetyMailerSettings, Func <SendGridClient> clientFunc, SendGridMailerSettings mailerSettings, ILogger <SendGridMailer> logger = null, IHistoryStore store = null ) { factory.Register(() => new SafetyMailer <SendGridMailer>( new SendGridMailer ( clientFunc(), mailerSettings, logger ?? factory.DefaultLoggerFactory?.CreateLogger <SendGridMailer>(), factory.ConfigureHistoryStoreLogger(store) ), safetyMailerSettings)); }