File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Mail Alerts on birthdays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Mail Alerts on birthdays" Watch "Mail Alerts on birthdays" New topic
Author

Mail Alerts on birthdays

mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Hi ranchers,

Currently I am working on a project which uses servlets and jsp. I am sending mails from my jsp page. But now I have struck at one point. I need to send automatic mail on his birthday date which he registered . I am using mysql database as back end . Any solution will be most useful for me.

Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

JSP and servlets will be of no help to you in this task.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

What is preventing you from getting a solution?

(We don't like to do people's work for them here, but we do like to work with them as they do it.)
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

JavaMail would be of help for your project


Ashwin Sridhar
SCJP | SCWCD | OCA
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Bear Bibeault wrote:JSP and servlets will be of no help to you in this task.



Sir How can i achieve this without servlets and jsp's . Is there any other technology or else please give me your valuable reply...
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Ashwin Sridhar wrote:JavaMail would be of help for your project



Actually I am sending mails when clicking on button like "tell to friend" but what is my intention is there must be a thread that must be working as long as the application is in server whether client requests or not .


Executing a thread until server stops.... this is my requirement any suggestion....

Thanks in advance
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Paul Clapham wrote:What is preventing you from getting a solution?

(We don't like to do people's work for them here, but we do like to work with them as they do it.)



Actually I am sending mails when clicking on button like "tell to friend" but what is my intention is there must be a thread that must be working as long as the application is in server whether client requests or not .

I struck at how to run a thread continuously until server stops/ application is deleted from server.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

I'd just write a standalone application that would be triggered by a cron job once a day and send out emails as necessary.
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57


Thanks for replying sir,

Bear Bibeault wrote:I'd just write a standalone application that would be triggered by a cron job once a day and send out emails as necessary.



Sir i think i have to use threads is n't it? if it which thread i have to use.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

No, why? Just write an application that checks the db for birthdays, sends out emails as appropriate, and shuts down. Run it once a day as a cron job. Why make things more difficult than they need to be?
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Bear Bibeault wrote:No, why? Just write an application that checks the db for birthdays, sends out emails as appropriate, and shuts down. Run it once a day as a cron job. Why make things more difficult than they need to be?


Thanks for reply

I am unaware of cron jobs as i am fresher. is there any API to built cron jobs in java . when i searched in google it shows Quartz API to develop cron jobs any other resource i don't want to use any third party tools like quartz is there any please reply me I am eagerly waiting for your reply....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

It's the other way around, cron starts the Java program. Again, you are making this too complicated.

On Windows, you'll need to find the equivalent for cron.
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Bear Bibeault wrote:It's the other way around, cron starts the Java program. Again, you are making this too complicated.

On Windows, you'll need to find the equivalent for cron.


Thanks for reply,


This answer is correct if in my own system i have to send mails ,

But equivalent to cron jobs is Scheduled tasks in windows I may configure this tasks in my windows system. But requirement is I have to place application in server(On web). and takes date of birth from mysql database using JDBC and sends mail...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

Is the server a Unix system?
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Bear Bibeault wrote:Is the server a Unix system?


yes sir.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

Then it will have cron.
mike mimmis
Ranch Hand

Joined: Feb 11, 2011
Posts: 57

Bear Bibeault wrote:Then it will have cron.


I got the solution Thanks a lot sir......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mail Alerts on birthdays