Can any one out there help me to solve my problem in Sending mail automatically.
I am developing a mailing system which searches the database and fetches the day,month
in the DOB of registered User. Then, it automatically sends the Greeting message to all the registered
User whose date and month in their DOB match with the current date and month.
Can any one give an idea about this. I have developed the code for this but don't know How to
invoke a servlet automatically.
My questions are,
* Is there any way to Init a servlet automatically? If yes, How?
* Is there any other way to send Greeting messages to all the registered users automatically?
I thake U in advance for answering my Query.
Please,send me the reply to vinu242eth.net
i think it that the date of birth list will be in the database in the particular column when the the current date matches with the date in database u sent themail the for this program shuould run always.As soon as it finds it will push the alert by using JavaMail A.P.I there u having thses fecilitites to send the mail alerts automatically
I dont think that a servlet is the right way to do this. But to answer your first question first: there is a load-on-startup (I think that's what its called) parameter in the web.xml file which will specify which servlets are initialized when the container starts up. However - if you were to do that, you would need to have a thread running that every day sent out the emails. Thing is, servlets are request/response orientated - you aren't using that. I suppose you could write a servlet with only init and destroy methods which had a thread sleeping and once a day sent out the birthday messages for that day.
Hope this helps. Look at the servlet spec (java.sun.com/products/servlet) for details on the web.xml file.
How about a daemon thread invoked from a java application which triggers the mailer object and picks up the mail IDs of all the registered users satisfying the criteria, sends the greeting mail to all the registered users. This daemon thread will be alive once the time crosses 00:00 hours.
(Thread priority could be moderate <=4 ).
Do we need to go for servlet??? In what way servlet is applicable here??? WLTD further.
Vamsi Kalyan Poondla
Weblogic application server provides Timer Service, which can execute your mail application at specified interval. You look into your web server for simillar services, if needed.