Email Trace Listener Not Sending Emails - In Code, Works

Topics: Exception Handling Application Block, Logging Application Block
Feb 17, 2010 at 10:56 PM

Hi, I have set up a email trace listener reference with all the properties and dependencies correct. In this code:

protected void Page_Load(object sender, EventArgs e)
    Exception exception = new Exception("Test 2");

    ExceptionPolicy.HandleException(exception, "Exception Policy");


private void SendMail()
    Server.ScriptTimeout = 1000;
    MailMessage message = new MailMessage("", "", "Test", "Test...");
    SmtpClient emailClient = new SmtpClient("", 25);


        Response.Write("The Mail has been sent to: ");
    catch (Exception ex)


The category handling the exception has an email and a database trace listener. The database records the above log event fine but the email is never sent (there is no error or exception reported in the event log regarding sending the email).

The email trace listener uses the same information as the SendMail() method above - SendMail executes fine and the email is received but the email trace listener does not...

What do I do to trace the problem??








Feb 18, 2010 at 1:48 AM

Did you add the Formatted EventLog Trace Listener under the Logging Errors and Warnings Section? If you had already, do you have the option to configure the properties of your smtp server?

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

    Sarah Urmeneta
    Global Technology and Solutions
    Avanade, Inc.