Class SmtpAlertHandlerConfiguration
Represents configuration for SmtpAlertHandler - the handler that allows to send e-mail messages with alert content.
Implements
Inherited Members
Namespace: Nevatech.Vsb.Repository.Alerts
Assembly: Nevatech.Vsb.Repository.dll
Syntax
[DataContract(Namespace = "http://schemas.nevatech.com/sentinet/2011/02")]
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
[DataMember(EmitDefaultValue = false)]
public string BodyFooter { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
BodyHeader
Gets or sets string to be printed int the beginning of e-mail body.
Declaration
[DataMember(EmitDefaultValue = false)]
public string BodyHeader { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
BodyTemplate
Gets or sets template string used to print single alert details in the e-mail body.
Declaration
[DataMember(EmitDefaultValue = false)]
public string BodyTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ErrorMessage
Gets the message indicating the errors found during validation process.
Declaration
public string ErrorMessage { get; }
Property Value
| Type | Description |
|---|---|
| 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
[DataMember(EmitDefaultValue = false)]
public bool IsBodyHtml { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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
[DataMember(EmitDefaultValue = false)]
public bool IsMessagePerAddress { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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
[DataMember(EmitDefaultValue = false)]
public bool IsMessagePerAlert { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Subject
Gets or sets the string used as e-mail subject.
Declaration
[DataMember]
public string Subject { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
To
Gets or sets the string containing e-mail addresses of the message recipients.
Declaration
[DataMember(EmitDefaultValue = false)]
public string To { get; set; }
Property Value
| Type | Description |
|---|---|
| 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
[DataMember]
public Collection<FolderUsers> ToFolderUsers { get; }
Property Value
| Type | Description |
|---|---|
| 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
[DataMember(EmitDefaultValue = false)]
public string ToPropertyName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ToUsers
Gets collection of the user identifiers used to find recipient e-mail addresses.
Declaration
[DataMember]
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 |
|---|---|---|
| string | address | Recipient's email address. |
| string | displayName | Recipient's display name (optional). |
Validate()
Evaluates the state of the object.
Declaration
public bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if state is valid; otherwise, false. |