/// <summary> /// Initialize a SendGridRepository class with a mail message /// </summary> /// <param name="settings"></param> /// <param name="message"></param> /// <param name="logger"></param> public SendGridRepository(model.AppSettings settings, SendGridMessage message, ILogger <SendGridRepository> logger) { this.logger = logger; try { client = new SendGridClient(settings.ApiKey); Message = message; } catch (Exception ex) { logger.LogCritical(ex, "Error configuring the Sendgrid Client"); } }
/// <summary> /// Initialize an SmtpRepository class with a mail message /// </summary> /// <param name="settings"></param> /// <param name="message"></param> /// <param name="logger"></param> public SmtpRepository(model.AppSettings settings, MailMessage message, ILogger <SmtpRepository> logger) { this.logger = logger; try { client = new SmtpClient(settings.SmtpServer); Message = message; } catch (Exception ex) { logger.LogCritical(ex, "Error configuring Stmp Client"); } }
/// <summary> /// Initializes the SendgridRepository with logging and the ApiKey /// </summary> /// <param name="settings"></param> /// <param name="logger"></param> public SendGridRepository(model.AppSettings settings, ILogger <SendGridRepository> logger) : this(settings, new SendGridMessage(), logger) { }
/// <summary> /// Initializes the SmtpRepository with the server /// </summary> /// <param name="settings"></param> /// <param name="logger"></param> public SmtpRepository(model.AppSettings settings, ILogger <SmtpRepository> logger) : this(settings, new MailMessage(), logger) { }