override public void Initialize(string name, NameValueCollection config) { Debug.Trace("MailWebEventProvider", "Initializing: name=" + name); ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref _from); // Read "to", "cc" and "bcc" ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref _to); ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref _cc); ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref _bcc); if (String.IsNullOrEmpty(_to) && String.IsNullOrEmpty(_cc) && String.IsNullOrEmpty(_bcc)) { throw new ConfigurationErrorsException( SR.GetString(SR.MailWebEventProvider_no_recipient_error, this.GetType().ToString(), name)); } ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref _subjectPrefix); ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref _maxMessagesPerNotification); ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref _maxEventsPerMessage); _smtpClient = CreateSmtpClientWithAssert(); base.Initialize(name, config); }
public override void Initialize(string name, NameValueCollection config) { ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref this._from); ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref this._to); ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref this._cc); ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref this._bcc); if ((string.IsNullOrEmpty(this._to) && string.IsNullOrEmpty(this._cc)) && string.IsNullOrEmpty(this._bcc)) { throw new ConfigurationErrorsException(System.Web.SR.GetString("MailWebEventProvider_no_recipient_error", new object[] { base.GetType().ToString(), name })); } ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref this._subjectPrefix); ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref this._maxMessagesPerNotification); ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref this._maxEventsPerMessage); this._smtpClient = CreateSmtpClientWithAssert(); base.Initialize(name, config); }