Enterprise library - sending email with attachment

Topics: Logging Application Block
Aug 3, 2011 at 9:29 PM

Is it possible? I want to send also an attachment when I use the email trace listener but couldn't find any reference that it can be done.

Aug 4, 2011 at 4:38 AM

Hi,

Yes, you can achieve that by extending the Email Trace Listener. You can take a look the Enterprise Library Source Code, specifically on EmailTraceListener.cs, so you can have an idea. Basically, its the TraceData method which is called when the trace listener logs the data.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 4, 2011 at 9:04 PM

Thanks!

One more question: If I want to make the template for the text formatter culture dependent using resx files, do I need to extend the TextFormatter class?

Aug 5, 2011 at 12:14 PM

Yep, for out of the box behaviour extending the formatter is the right way to go :o)

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Nov 27, 2013 at 9:27 PM
Just so that you do not bit around bushes as I did here are few tips. Along with looking at source code for EmailTraceListener.cs you should also look at source code of EmailTraceListenerData specifically GetCreationExpression method override. When you implement say 'EmailWithAttachmentTraceListener' inherting from EmailTraceListener make sure you also create say 'EmailWithAttachmentTraceListenerData' inherting EmailTraceListenerData overriding GetCreationExpression method. Also decorate your 'EmailWithAttachmentTraceListener' class with [ConfigurationElementType(typeof(EmailWithAttachmentTraceListenerData))].
Sep 1, 2014 at 1:51 PM
Hi Rajesh Can you explain with an example
Thanks