Router Class |
Namespace: SMTPRouter
The Router type exposes the following members.
| Name | Description | |
|---|---|---|
| Router |
Initializes a new instance of a Router | |
| Router(String) |
Initializes a new instance of a Router and sets the Queue Path to be the Current Directory
| |
| Router(String, String) |
Initializes a new instance of a Router |
| Name | Description | |
|---|---|---|
| DestinationSmtps |
A Dictionary containing the Smtp Configuration based on a Key name
| |
| Folders |
A structure representing the queue folders
| |
| IsInitialized |
Returns a flag to inform if the router is initialized
| |
| IsPaused |
Defines whether the routing process is Paused or Running
| |
| MessageLifespan |
The TimeSpan a message is stil considered valid to retry. By default, a message lasts 15 minutes after its creation time
| |
| MessagePurgeLifespan |
The TimeSpan a message remains on the queues. By default a message remains there for 90 days before being purged.
| |
| QueueName |
Represents the Queue Name
| |
| QueuePath |
Represents the Queue Path
| |
| RoutingRules |
List of Rules to be applied when routing messages
|
| Name | Description | |
|---|---|---|
| Enqueue |
Adds a message to the proper queue
| |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| LoadRoutingRules |
Load Routing Rules from a Text File
| |
| LoadSmtpConfiguration |
Load Smtp Configuration from a Text File
| |
| PurgeQueues |
Purges queues for messages older then the MessagePurgeLifespan | |
| SaveRoutingRules |
Saves the existing routing rules to a text file
| |
| SaveSmtpConfiguration |
Saves the existing Smtp Configuration to a Text File
| |
| StartAsync |
Starts the Message Routing
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
| GeneralError |
Event triggered when a general error happens on the processing
| |
| MessageNotRouted |
Event triggered when a message could not be routed successfully
| |
| MessagePurging |
Event triggered when a message is about to be purged by the system.
| |
| MessageRoutedSuccessfully |
Event triggered when a message is routed successfully
| |
| MessagesPurged |
Event triggered after messages are purged
|
// Create the Router var router = new SMTPRouter.Router("SMTPRouter", "C:\\SMTPRouter\\Queues") { MessageLifespan = new TimeSpan(0, 15, 0), RoutingRules = new List<Models.RoutingRule>() { new Models.MailFromDomainRoutingRule(10, "gmail.com", "gmail"), new Models.MailFromDomainRoutingRule(20, "hotmail.com", "hotmail") }, DestinationSmtps = new Dictionary<string, Models.SmtpConfiguration> { { "gmail", new Models.SmtpConfiguration() { Host = "smtp.gmail.com", Description = "Google Mail SMTP", Port = 587, RequiresAuthentication = true, User = "user@gmail.com", Password = "", } }, { "hotmail", new Models.SmtpConfiguration() { Host = "smtp.live.com", Description = "Hotmail SMTP", Port = 587, RequiresAuthentication = true, User = "user@hotmail.com", Password = "", } } }, }; router.MessageRoutedSuccessfully += Server_MessageRoutedSuccessfully; router.MessageNotRouted += Server_MessageNotRouted;