Please help... Email Trace Listener Configuration

Topics: Enterprise Library Core, General discussion, Logging Application Block
Jun 22, 2012 at 4:39 AM


I'm trying to configure an email trace listener in Ent Lib 5.0 (without the optional update 1).  No matter what I do, it won't send emails.

I've created a very simple test app and that won't send the emails either.  The Database Trace Listener works, so I'm certain that the entries are getting caught by the logger.  They just aren't being processed by the email trace listener.

I've tried configuring the special categories to capture log errors that could be occurring, but nothing gets logged from that.  

The severity filters on the category and the listener are both set to "All".  Auto Flush on the category is set to true.  I've tried with a formatter and without, same result.  I've tried an IP for SMTP server instead of the FQDN, same result.

Can anyone help with this?

1) Are there any specific assembly references I need to add for the Email Trace Listener?  Does anyone know the exact set of references that will work for this?

2) I've tried many SMTP servers, including gmail.  They work outside of logging, even when I use an SmtpClient straight from my test app.  The SmtpClient will send using the same credentials as the logger, but the logger doesn't send.  

Trace listener config is below.


- Scott

        <listeners>            <add name="Email Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"                toAddress="" fromAddress=""                subjectLineStarter="AAA" subjectLineEnder="ZZZ" smtpServer=""                smtpPort="587" authenticationMode="UserNameAndPassword" useSSL="true"                userName="" password="passwordobscured" />        </listeners>

Jun 29, 2012 at 5:57 PM

Gmail seems to work fine for me with the EmailTraceListener.  The sending of email is synchronous so the email is either sent or an error is raised.  Silly question: are you sure that you are using the configuration that you expect?

What happens if you configure the errors special source (e.g. to go to a flat file) and then deliberately enter invalid configuration.  For example if you enter smtpPort="-1" you should get the message "Specified argument was out of the range of valid values." written to the errors special source.  That would show that the configuration is being used properly.

Even security/permission/firewall issues should result in an exception so other places to look might be the external email server or check the target's SPAM folder.  

Here is the configuration I used:

<add name="Email Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    toAddress="" fromAddress=""
    smtpServer="" smtpPort="587" authenticationMode="UserNameAndPassword"
    useSSL="true" userName="" password="fromAddress_Password" />

Randy Levy
Enterprise Library support engineer