Content Studio Web Content Management System
Assembly: CSSubscriptionEventHandler (in CSSubscriptionEventHandler.dll) Version: 1.0.0.0 (1.0.0.0)
true if the subscriber is valid and should receive a message, otherwise, false
This method gets called by the eventhandler once for each subscriber found on
the subscription handled.
[This is preliminary documentation and is subject to change.]
Validates the subscriber to see if he/she should receive the message.
Namespace: ContentStudio.Document.Subscription.EventHandler
Assembly: CSSubscriptionEventHandler (in CSSubscriptionEventHandler.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
Parameters
- subscriber
- Type: ContentStudio.Document.Subscription.EventHandlerSubscriptionInformation
The subscriber to validate.
Return Value
Type: Booleantrue if the subscriber is valid and should receive a message, otherwise, false
Remarks
This implementation sets the receiver of the message to the passed in subscriber an verfies that the email address is correct.
Derived classes can override this method to provide their own receiver logic. For example, a handler on an intranet needs to ensure that only members in a specific Active Directory security group, such as Domain Admins, are entitled to receive messages.
Note |
---|
If your implementation does not call its base class implementation you must
ensure that you set the receiver of the message to the subscriber passed in.
You can use the following code to accomplish this.
C# protected override bool ValidateSubscriber(SubscriptionInformation subscriber) { //Your implementation goes here //normally you just call the implementation on the base class //return base.ValidateSubscriber(subscriber); //As an alternative you can set the receiver address yourself //this code duplicates the existing implementation of //the MailSubscriptionHandler class. try { MailAddress address = new MailAddress(subscriber.Address, subscriber.Name); Message.To.Clear(); Message.To.Add(address); } catch (FormatException) { WriteToLog(SyslogPriority.Warning, String.Format("Invalid mail address {0}", subscriber.Address)); return false; } catch (ArgumentException) { WriteToLog(SyslogPriority.Warning, String.Format("Invalid mail address {0}", subscriber.Address)); return false; } return true; } |
Note |
---|
If this method returns false the message will not be sent out to the subscriber. |
See Also