This project is read-only.


We've added a new destination listener extension for ReflectInsight for sending emails. This new destination listener extension is called ReflectSoftware.Insight.Listeners.Email and allows you to send logging messages via email. This is typically done for Exceptions, Errors and Fatal messages types where you might want to be notified via email if something went wrong in your application.

Email Destination Listener Configuration

1. Download and install the ReflectInsight Viewer. You will need this installed to view your messages from the ReflectInsight Logging Extensions.


2. Download the ReflectInsight Listener Extension Binaries or Source and rebuild if necessary. We already include the ReflectSoftware.Insight.Listeners.Email.dll in the libraries folder as part of the above ReflectInsight download, but we will be removing this and making it available as a NuGet package.

3. Once you have the ReflectInsight Listener Extensions, go to your project in Visual Studio and add a reference to:
  • ReflectSoftware.Insight.dll
  • ReflectSoftware.Insight.Listeners.Email.dll.
4. The next step is to configure your app or web configuration file and incorporate the ReflectInsight Email Listener. If you don't already have an App.config or Web.config, add it. Then open the configuration file and add a new ConfigSection as shown here:

    <section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler,ReflectSoftware.Insight"/>
5. Now you will need to add and configure the <> mail settings section in your configuration file and set the appropriate values:

      <smtp from="">
        <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" />
6. Now you will need to add the InsightSettings section. You can get started with the following simple configuration which only includes the necessary details for this demo:

      <listener name="Email" type="ReflectSoftware.Insight.Listeners.ListenerEmail, ReflectSoftware.Insight.Listeners.Email"/>

      <details name="emailDetails1">
        <subject>Application Alert: %message%</subject>
          The following error was detected in application: '%application%'<br/><br/>          
          Message Type: %messagetype% 
			    Category:     %category% 
			    Computer:     %machine% 
			    Sender Id:    %senderid% 
			    Request Id:   %requestid% 
			    Process Id:   %processid% 
			    Thread Id:    %threadid% 
			    Domain Id:    %domainid% 
			    Application:  %application% 
			    User Domain:  %userdomain% 
			    Username:     %username%
                            Timestamp:    %time% or %time{dd-MM-yyyy hh:mm:ss.fff}%
          Please call technical support: 1-888-555-5555

    <listenerGroups active="Active">
      <group name="Active" enabled="true" maskIdentities="false">
          <destination name="Email" enabled="true" filter="ErrorWarningFilter" details="Email[details=emailDetails1]"/>
      <filter name="ErrorWarningFilter" mode="Include">
        <method type="SendError"/>
        <method type="SendException"/>
        <method type="SendFatal"/>

7. Notice the <emailDetails> section. It's in here that you define your email template. You can pass in parameters, which is shown above for example.

8. In the <listenerGroups> section, you will need to configure the Email destination and include a filter to use. The filter is defined in the <filteres> section, which you specify the messages to include or exclude from being sent to that destination. In our example, we only want to include the Error, Exception and Fatal message types. Whenever one of these messages is received, it will be delivered via email.

9. That's it, you're done!

As you can see it's very easy to get started with using the Email Listener. You can view the source and create your own listeners too.

NuGet Package

We've created a NuGet package for our Email Listener Destination extension. You can find it over on Nuget.

To install ReflectSoftware.Insight.Listeners.Email extension, run the following command in the Package Manager Console.


Last edited Jul 31, 2013 at 2:03 AM by RSDeveloper, version 14