Email Trace Listener will not send emails

Topics: Logging Application Block
Jul 21, 2009 at 1:45 PM

Hi

I am using ent lib jan 2006.

My Email Trace Listener is not sending emails and I don't understand why. Here are its settings

<add toAddress="andrea@digio.co.uk" fromAddress="error@suretrack.co.uk"
        subjectLineStarter="" subjectLineEnder="" smtpServer="127.0.0.1"
        smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        name="Email TraceListener" />

 

I have tried swapping 127.0.0.1 for localhost and that makes no difference. I have been able to send an email from vb.net by setting the smtp server to both localhost and 127.0.0.1 so i do believe the problem is with the enterprise library. The from address is made up but i dont believe that matters as i made up the from address when i sent the emails from vb.net

Many thanks

Jul 22, 2009 at 7:48 AM

Hi,

Are there any exception  being thrown? Or are there logs regarding the failure of the sending. Can you please try using your IP address, the one you'll see when you issue a "ipconfig" at the command prompt.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 31, 2009 at 1:46 AM

Hi

There are no errors being thrown by the server with respect to sending the email. The email trace listener is supposed to be triggered by an exception policy and the underlying error that should trigger the email trace listener is occuring and being logged by another listener simultaneously.

I tried to configure the email trace listener to use the ip address that i see from ip config but that didn't work either.

Does it make a difference that the machine this code is running on has both an internal and external network card. Here is what you see in ipconfig. I removed the ip addresses in case there is any security risk. I don;t know much abotu networks so i don't know if this step is unnecessary but better safe than sorry

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>IPCONFIG

Windows IP Configuration


Ethernet adapter External Network:

   Connection-specific DNS Suffix  . :
   IP Address. . . . . . . . . . . . : Some external ip
   Subnet Mask . . . . . . . . . . . : 255.255.255.248
   Default Gateway . . . . . . . . . : Some external ip

Ethernet adapter Internal Network:

   Connection-specific DNS Suffix  . :
   IP Address. . . . . . . . . . . . : 192.168.11.10
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

C:\Documents and Settings\Administrator>
thanks
Aug 3, 2009 at 9:42 AM
Edited Aug 3, 2009 at 9:43 AM

Hi,

As for further investigation, What you can do is to add a FormattedEventLogTraceListener in the Special Sources > Logging Errors & Warnings section of the Logging Application Block so the error may be logged. It happened to me before that (Testing a email trace listener), there is no runtime error/exception that occurs but there are error that was logged regarding the failure of the mail sending. It might help in finding out what's happening during the process.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Aug 10, 2009 at 4:44 PM

Hi

I believe there is already one of these set up and its not logging any errors. This is taken from the config file and I believe this is saying there is a formatted event log listening to Logging Errors & Warnings

Is there anything else i can do?

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
      <add databaseInstanceName="ErrorLoggingConnectionString" writeLogStoredProcName="WriteLog"
        addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        name="Database Trace Listener" />
      <add toAddress="andrea@digio.co.uk" fromAddress="error@suretrack.co.uk"
        subjectLineStarter="" subjectLineEnder="" smtpServer="127.0.0.1"
        smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        name="Email TraceListener" />
      <add source="Enterprise Library Logging" formatter="Text Formatter"
        log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        name="Formatted EventLog TraceListener" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
        name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="Critical">
        <listeners>
          <add name="Email TraceListener" />
          <add name="Database Trace Listener" />
        </listeners>
      </add>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Formatted EventLog TraceListener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
Aug 11, 2009 at 4:19 AM

Could you try configuring the properties of your default smtp server?  In the General tab, select your ip address, and then click Apply.  Go to the Access tab, click on the Relay button, Select the Only the list below radio button and add your ip address.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Aug 25, 2009 at 11:42 AM

Hi

I'm in a bit of a difficult position because the computer this code is running on is the network domain controller.
 I don't want to mess about with the network settings but the person responsible for the network is just totally unavailable.
Where do i configure the default smtp server please?
thanks

 

Aug 26, 2009 at 5:47 AM

Hi,

Are you using a XP machine? You can try these steps:

  1. Right-Click on My Computer , click Manage
  2. Expand the Services and Applications node
  3. Expand the Internet Information Services
  4. Right-Click on the "Default SMTP Virtual Server" > Properties
  5. In the General tab, there is a IP address dropdown. try selecting your local IP address.
  6. Go to the Access tab
  7. Click the Relay button below.
  8. Select the "Only the list below" option
  9. Add your IP address on the list
  10. OK.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 1, 2009 at 10:53 PM

Hi

I am using windows small business server 2003. The machine in question is also the domain controller.

many thanks

Sep 2, 2009 at 3:08 AM

Does the steps I've provided not feasible for you? The idea here is get to the setting of your IIS then you'll find there the SMTP virtual server. Then continue with the steps.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com