Class SmtpAlertHandlerConfiguration
Represents configuration for SmtpAlertHandler - the handler that allows to send e-mail messages with alert content.
Inheritance
Implements
Inherited Members
Namespace: Nevatech.Vsb.Repository.Alerts
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class SmtpAlertHandlerConfiguration : IValidator
Examples
<SmtpAlertHandlerConfiguration xmlns="http://schemas.nevatech.com/sentinet/2011/02"> <BodyFooter> SMTP Alert Handler</BodyFooter> <BodyHeader>Sentinet received the following alerts:</BodyHeader> <BodyTemplate> * At { DateTime}. Description: '{Description}'. Data: '{Data}'</BodyTemplate> <IsMessagePerAddress>true</IsMessagePerAddress> <IsMessagePerAlert>true</IsMessagePerAlert> <Subject>Sentinet Alert(s)</Subject> <To>Administrator <admin@test.com>, "Smith, John" <john.smith@test.com></To> <ToFolderUsers> <FolderUsers> <IncludeSubfolders>true</IncludeSubfolders> <SecurityRoles> <RoleId>1</RoleId> <RoleId>2</RoleId> </SecurityRoles> </FolderUsers> </ToFolderUsers> <ToUsers> <UserId>1</UserId> </ToUsers> </SmtpAlertHandlerConfiguration>
Constructors
SmtpAlertHandlerConfiguration()
Initializes an empty instance.
Declaration
public SmtpAlertHandlerConfiguration()
Properties
BodyFooter
Gets or sets string to be printed int the end of e-mail body.
Declaration
public string BodyFooter { get; set; }
Property Value
Type | Description |
---|---|
System.String |
BodyHeader
Gets or sets string to be printed int the beginning of e-mail body.
Declaration
public string BodyHeader { get; set; }
Property Value
Type | Description |
---|---|
System.String |
BodyTemplate
Gets or sets template string used to print single alert details in the e-mail body.
Declaration
public string BodyTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ErrorMessage
Gets the message indicating the errors found during validation process.
Declaration
public string ErrorMessage { get; }
Property Value
Type | Description |
---|---|
System.String |
IsBodyHtml
Gets or sets flag indicating that message body is formatted as HTML. If set to True, then combined BodyHeader, BodyTemplate, and BodyFooter values should result into a valid HTML page.
Declaration
public bool IsBodyHtml { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMessagePerAddress
Gets or sets flag indicating that individual message should be sent to each e-mail address. If False, one message is sent containing all e-mail addresses.
Declaration
public bool IsMessagePerAddress { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMessagePerAlert
Gets or sets flag indicating that individual message should be sent per each alert. If False, all outstanding alerts are grouped and sent in single e-mail message.
Declaration
public bool IsMessagePerAlert { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Subject
Gets or sets the string used as e-mail subject.
Declaration
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
System.String |
To
Gets or sets the string containing e-mail addresses of the message recipients.
Declaration
public string To { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Examples
The format of the string is the following:
"Administrator <admin@test.com>, "Smith, John" <john.smith@test.com>"
ToFolderUsers
Gets collection of folders containing users which need to receive the e-mail. Each entry allow to define a folder tree and collection of security roles that user should belong to receive the message.
Declaration
public Collection<FolderUsers> ToFolderUsers { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.Collection<FolderUsers> |
ToPropertyName
Gets or sets the name of alert custom property where email address should be taken from. If this property is populated then IsMessagePerAlert must be set to True.
Declaration
public string ToPropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ToUsers
Gets collection of the user identifiers used to find recipient e-mail addresses.
Declaration
public SmtpAlertHandlerConfiguration.UserCollection ToUsers { get; }
Property Value
Type | Description |
---|---|
SmtpAlertHandlerConfiguration.UserCollection |
Methods
AddRecipient(String, String)
Adds recipient's address to the value of To property.
Declaration
public void AddRecipient(string address, string displayName)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | Recipient's email address. |
System.String | displayName | Recipient's display name (optional). |
Validate()
Evaluates the state of the object.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
System.Boolean | True if state is valid; otherwise, false. |