I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version

Topics: Exception Handling Application Block, Logging Application Block
Sep 23, 2009 at 9:51 AM

Hi All,

I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version

Can you please send me the code for sending mail

If I am getting any error in application level I have to send mail . this is my requirement

I have written code in web.config file

Even though I am not able to sending mail

Please help me

Thanks

Karunakar

Sep 23, 2009 at 12:19 PM

Hi,

For the "If I am getting any error in application level I have to send mail" requirement. You may set the "SourceLevels" property of the Category to "Error" so that it will only allow Error LogEntries. I'm not really sure why are you not being able to send mails. Do you get any exception? Also to capture any exception that might occur during the process of the email trace listener, you can add another tracelistener, say event log. Then add it to "Logging Errors & Warnings", for that instance, if a exception occurs in the email trace listener, the exception will be logged to the event log. Please give it a try.

 

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

Sep 23, 2009 at 12:56 PM

Hi Valiant

I have added below code in web.config file

Any thing I have forgot please let me know

Thanks & Regards,

Venu

<loggingConfiguration name="Logging Application Block" tracingEnabled="true"

defaultCategory="" >

<listeners>

<add toAddress="karunakarraop@stcroixsystems.com" fromAddress="pkkrao@gmail.com"

subjectLineStarter="-venuStart-" subjectLineEnder="-venuEnd-" smtpServer="smtp.compnayname.com"

smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

traceOutputOptions="DateTime" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

name="Email TraceListener" />

</listeners>

<formatters>

<add template="Timestamp: {timestamp} Message: {message} "

type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

name="TextFormatter" />

</formatters>

<categorySources>

<add switchValue="All" name="EmailCategory">

<listeners>

<add name="EmailTraceListener" />

</listeners>

</add>

</categorySources>

<specialSources>

<allEvents switchValue="All" name="All Events" />

<notProcessed switchValue="All" name="Unprocessed Category" />

<errors switchValue="All" name="Logging Errors & Warnings" />

</specialSources>

</loggingConfiguration>


From: AvanadeSupport [mailto:notifications@codeplex.com]
Sent: Wednesday, September 23, 2009 5:50 PM
To: karunakarraop@stcroixsystems.com
Subject: Re: I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version [entlib:69818]

From: AvanadeSupport

Hi,

For the "If I am getting any error in application level I have to send mail" requirement. You may set the "SourceLevels" property of the Category to "Error" so that it will only allow Error LogEntries. I'm not really sure why are you not being able to send mails. Do you get any exception? Also to capture any exception that might occur during the process of the email trace listener, you can add another tracelistener, say event log. Then add it to "Logging Errors & Warnings", for that instance, if a exception occurs in the email trace listener, the exception will be logged to the event log. Please give it a try.

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

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 24, 2009 at 5:37 AM

Hi,

Your configuration looks good. There are just few things that I've noticed. 1) in the trace listener section, you've added a email trace listener with a name of "Email TraceListener" with space in between. Then, In the category sources section, its now "EmailTraceListener" without space. When I tried this, the trace listener reference got broken. 2) Your requirement is to fire the email trace listener when a error occurs. Please set the "SourceLevels" property of the Category to "Error" so that it will only allow Error LogEntries. I'll try sending a sample solution with regards to usage of the email trace listener.

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

Sep 25, 2009 at 6:16 AM

Hi valliant,

Can you please send me the sample code of email sending when I am getting error in application level

Regards,

karunakar


From: AvanadeSupport [mailto:notifications@codeplex.com]
Sent: Thursday, September 24, 2009 11:08 AM
To: karunakarraop@stcroixsystems.com
Subject: Re: I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version [entlib:69818]

From: AvanadeSupport

Hi,

Your configuration looks good. There are just few things that I've noticed. 1) in the trace listener section, you've added a email trace listener with a name of "Email TraceListener" with space in between. Then, In the category sources section, its now "EmailTraceListener" without space. When I tried this, the trace listener reference got broken. 2) Your requirement is to fire the email trace listener when a error occurs. Please set the "SourceLevels" property of the Category to "Error" so that it will only allow Error LogEntries. I'll try sending a sample solution with regards to usage of the email trace listener.

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

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 25, 2009 at 7:08 AM

Let me ask this first, does your smtp server requires authentication? 

 

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

Sep 25, 2009 at 8:51 AM

With out authentication how can we use it Please let me know.

Thanks & Regards,

Venu.


From: AvanadeSupport [mailto:notifications@codeplex.com]
Sent: Friday, September 25, 2009 12:39 PM
To: karunakarraop@stcroixsystems.com
Subject: Re: I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version [entlib:69818]

From: AvanadeSupport

Let me ask this first, does your smtp server requires authentication?

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

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 28, 2009 at 3:07 AM

Hi,

Sample solution is sent.

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

Oct 12, 2009 at 6:55 AM

Hi

I want to mention user id and password in web.config file. I have mentioned smtp server in below tag

Even I am not getting any mail I would like to mention user id and password also

What are the property tags for credentials

<add toAddress="karunakarraop@stcroixsystems.com" fromAddress="karunakarraop@stcroixsystems.com"

subjectLineStarter="" subjectLineEnder="" smtpServer="64.26.60.227"

smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

name="Email TraceListener" />

Thnaks

Venu


From: AvanadeSupport [mailto:notifications@codeplex.com]
Sent: Monday, September 28, 2009 8:38 AM
To: karunakarraop@stcroixsystems.com
Subject: Re: I am not able to sending mail using listeners. Presently I am using Ent Lib 3.1 version [entlib:69818]

From: AvanadeSupport

Hi,

Sample solution is sent.

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

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Oct 12, 2009 at 7:44 AM

Hi,

The email tracelistener that comes with ent lib out-of-the-box does not support authentication. Either you change the email trace listener code to support authentication or use an authenticated mail tracelistener that can be found here: http://authemailtracelisten.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=1889 .

Related thread: http://entlib.codeplex.com/Thread/View.aspx?ThreadId=61770

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