tags:

views:

40

answers:

1

hi i am monitoring jvm and i am getting it statics like memory,number of threads etc and i want to generate mail notification depending on that conditions. can any give me some sample code on how to generate mails

A: 

The JavaMail download contains examples for how to use the javax.mail API:

http://java.sun.com/products/javamail/FAQ.html#examples

Look at the demo folder in the javamail-1.4.2.zip

Another approach would be to use log4j or another logging framework that supports an "Smtp/Email" appender. See the log4j site for examples on how to setup email logging.

Andy White