[Last Call] Learn how to a build a cloud-first strategyRegister Now


Enterprise Library .NET 2.0 Logging - HTML email

Posted on 2006-04-25
Medium Priority
Last Modified: 2008-09-05
Looking for examples on how to send an HTML formatted email using Enterprise Library for .NET 2.0 (Jan 2006) in the Logging Application Block.

Most tutorials I have seen show text emails, which in my opinion are obvious since it comes set up for that.  Any ideas on how to customize the email format to HTML
Question by:mrichmon
  • 2

Expert Comment

ID: 16542610
I recommend you to create another "sink", for example, an HTMLEmailSink, and configure the LogStrategy to use that sink depending on the configuration.

Another idea is to change the existing EmailSink. The text probably gets formatted there.

I don't know exactly what you need, but those are interesting idea.

Since the Enterprise Library sometimes need to be registered with strong name and any change make us re-register it all, I created my own Logging Application Block code. It's very simple and allows us to configure the logging, to create as many LogSinks as we need, to simply modify the LogStrategy and to avoid using the Configuration Application Block.

LVL 35

Author Comment

ID: 16544699

Sinks are in .NET 1.1.  They are no longer present in the Logging Application Block for Enterprise Library for .NET 2.0  Instead there are Trace Listeners, Formatters, etc.

As far as I have been able to determine there is no way to directly create html email messages.  The only option I see is to modify the Logging.Configuration.EmailMessage class to also take in a bit field indicating if you want HTML messages or Text messages.  Although I have not figured out how to then cause this change to be an option through the enterprise library configuration interface, only to manually modify the config file....

Please read the question carefully and do not answer if you don't know the situation being discussed.
LVL 35

Author Comment

ID: 16566247
Okay I found how to do this.  Not built in, but what I ended up doing was modifying Enterprise libarary to accept a parameter called IsBodyHtml.  I passed this parameter through all the way so that it can be accessed as a boolean field in the Enterprise Library confiuration program.

No I can set a bit field per listener to achieve this.

For others:

The files I needed to modify in the Logging and related assemblies included:

Accepted Solution

GranMod earned 0 total points
ID: 16594024
Closed, 250 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question