We’d like to introduce to you 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 as part of the next release. We will provide more details about this when it’s available on NuGet.
3. Once you have the ReflectInsight Listener Extensions, go to your project in Visual Studio and add a reference to the following assemblies:
- 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:

5. Now you will need to add and configure the <system.net> mail settings section in your configuration file and set the appropriate values:

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:

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 <filters> 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!
NuGet Package
We’ve also created a NuGet package for this extension. You can find it over on Nuget.
To install the ReflectInsight Email Destination Listener extension, run the following command in the Package Manager Console:

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

We welcome any feedback you may have. Feedback can be given at our UserVoice site.
Thanks
ReflectSoftware Team
Like this:
Like Loading...