You can use a thread  that  sleeps for ur required amount of time and then sends ur mail and then sleeps back .You can do all this in a while loop .
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Rajneesh Garg
Sent: Friday, March 31, 2000 12:29 AM
To: [EMAIL PROTECTED]
Subject: Sending EMails AUTOMATICALLY thro' Servlets and JavaMail

Hello,
 
I am working on a project involving servlets. Here, I am required to send an email at a particular hour of the day.
I know how to send an email using JavaMail. However, sending an email at a particular time, is giving me problems. I have written a small email program which can send the emails at a particular hour of the day. However, it occurs only when the servlet is running.
 
I have added this program to the JWS also. here too, I have mentioned that servlet be loaded automatically at the time of start up. However, it is not giving the desired results. Please help me in it.
Do I need to have a thread running all the times in background which will calculate the time, and will subsequently send the emails? I have not been able to implement this thread. However, at the same moment, I think it will be too costly to have a thread running in the background, calculating the time. What should be the optimised approach?
 
Any pointers in this directions, with or without helping code, will be highly helpful.
 
Regards,
 
Rajneesh Garg
 
Keep Smiling. It does improve your face value. :-)

Reply via email to