I am working at a project in JSP and Servlet. I am trying to add this functionality in my project. I want to automatically sent the email to particule person and particulr time. I had written the program in servlet and by compling and running the class file, the mail is auotmatically sent to the person. But What I want is it should be automatically run the class file, so that it can sent the mail.
I had written the business logic in the servlet, it will check the persons to be auto notify thu' email from th oracle DB and get the mail id of the persons to be sent. If I run the class file, mail is automatically send.
I want to run this class file on every monday at 3.00 pm. How can I do this. I tried in adding in the windows scheduled task, but the class file is opening and it has to run the class file, so that it can send the mail.
Please guide me in right direction in this regard.
Servlets are a very poor technology choice for this. Servlets are designed to be triggered by a request from a browser in order to create a response to send back. None of this matches your requirements.
I'd write a standalone Java program that could be scheduled to run when you need it to that performs this function. [ March 27, 2006: Message edited by: Bear Bibeault ]
When writing code to send mail, always remember that the mail server is a separate application - it may not even be running when you try to send, or it may reject your first try for some reason. Therefore, provide for recovery from sending errors, keeping the mail and later trying again - don't just drop the mail in the bit-bucket. Bill