public MailController(INotificationsSettings notificationsSettings, ISmtpClient mail, ITemplateTransformer templateTransformer, ILogger logger) { _notificationsSettings = notificationsSettings ?? throw new ArgumentNullException(nameof(notificationsSettings)); _mail = mail ?? throw new ArgumentNullException(nameof(mail)); _templateTransformer = templateTransformer ?? throw new ArgumentNullException(nameof(templateTransformer)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public static IEnumerable <MailAddress> GetBcc(this INotificationsSettings config, IEmailRecipientSettings recipients) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (recipients == null) { throw new ArgumentNullException(nameof(recipients)); } try { return(recipients.BccTokens.Select(token => config.SystemEmails.GetByToken(token)).Select(x => x.BuildMailAddress())); } catch (ArgumentOutOfRangeException ex) { throw new InvalidOperationException($"GetBcc failed for {recipients.Token} email", ex); } }
public static MailAddress GetFrom(this INotificationsSettings config, IEmailRecipientSettings recipients) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (recipients == null) { throw new ArgumentNullException(nameof(recipients)); } try { return(config.SystemEmails.GetByToken(recipients.FromToken).BuildMailAddress()); } catch (ArgumentOutOfRangeException ex) { throw new InvalidOperationException($"GetFrom failed for {recipients.Token} email", ex); } }
public NotificationsApi(IContextProvider contextProvider, INotificationsSettings settings) : base(contextProvider) { _settings = settings; }
public Application(SmtpSettings smtp, INotificationsSettings not) { _smtp = smtp; _not = not; }