Exemplo n.º 1
0
 /// <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");
     }
 }
Exemplo n.º 2
0
    /// <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");
        }
    }
Exemplo n.º 3
0
 /// <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)
 {
 }
Exemplo n.º 4
0
 /// <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)
 {
 }