Click or drag to resize

Listener Class

A class representing an SMTP Listener
Inheritance Hierarchy
SystemObject
  SMTPRouterListener

Namespace:  SMTPRouter
Assembly:  SMTPRouter (in SMTPRouter.dll) Version: 1.0.0.4
Syntax
public sealed class Listener

The Listener type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyIsListening
Defines whether the Listener is active or not
Public propertyPorts
Ports where the SMTP Service will be available
Public propertyRequiresAuthentication
Defines whether the SMTP Requires authentication
Public propertyServer
Reference to the SmtpServer
Public propertyServerName
Name of the Server where the services will run
Public propertyUseSSL
Defines whether it's necessary to use SSL or not
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStartAsync
Initializes a new instance of the Listener
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventListeningStarted
Event triggered when the Listener started to listen to smtp messages
Public eventMessageReceived
Event triggered when a message is received
Public eventSessionCommandExecuting
Event triggered when an SMTP Command is executing
Public eventSessionCompleted
Event triggered when an SMTP Session is completed
Public eventSessionCreated
Event triggered when an SMTP Session is created
Top
Remarks
The Listener will listen to Smtp Commands and fire events when messages are received
Examples
A Listener can be created using the code below:
// Create the Listener
var listener = new SMTPRouter.Listener()
{
    ServerName = "localhost",
    Ports = new int[] { 25, 587 },
    RequiresAuthentication = false,
    UseSSL = false
};

// Hook into events
listener.ListeningStarted += Server_ListeningStarted;
listener.SessionCreated += Server_SessionCreated;
listener.SessionCommandExecuting += Server_SessionCommandExecuting;
listener.SessionCompleted += Server_SessionCompleted;
listener.MessageReceived += Server_MessageReceived;
See Also