/// <summary> /// Construct a sink emailing with the specified details. /// </summary> /// <param name="connectionInfo">Connection information used to construct the SMTP client and mail messages.</param> /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param> /// <param name="subjectLineFormatter">The subject line formatter.</param> /// <exception cref="System.ArgumentNullException">connectionInfo</exception> public EmailSink(EmailConnectionInfo connectionInfo, ITextFormatter textFormatter, ITextFormatter subjectLineFormatter) { if (connectionInfo == null) { throw new ArgumentNullException(nameof(connectionInfo)); } _connectionInfo = connectionInfo; _fromAddress = MimeKit.MailboxAddress.Parse(_connectionInfo.FromEmail); _toAddresses = connectionInfo .ToEmail .Split(",;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Select(MimeKit.MailboxAddress.Parse) .ToArray(); _textFormatter = textFormatter; _subjectFormatter = subjectLineFormatter; }
/// <summary> /// Construct a sink emailing with the specified details. /// </summary> /// <param name="connectionInfo">Connection information used to construct the SMTP client and mail messages.</param> /// <param name="batchSizeLimit">The maximum number of events to post in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param> public EmailSink(EmailConnectionInfo connectionInfo, int batchSizeLimit, TimeSpan period, ITextFormatter textFormatter) : base(batchSizeLimit, period) { if (connectionInfo == null) { throw new ArgumentNullException(nameof(connectionInfo)); } _connectionInfo = connectionInfo; _fromAddress = MimeKit.MailboxAddress.Parse(_connectionInfo.FromEmail); _toAddresses = connectionInfo .ToEmail .Split(",;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Select(MimeKit.MailboxAddress.Parse) .ToArray(); _textFormatter = textFormatter; }