This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Regular mail sending on server application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regular mail sending on server application" Watch "Regular mail sending on server application" New topic
Author

Regular mail sending on server application

Pavels Hlopoks
Ranch Hand

Joined: Feb 05, 2007
Posts: 31
Hello! I have a problem.

I need once at week automatically send mail in my webapp...
How can I do it? I think I must deploy with my app some.. Some liberally or something like this.

Actually problem is - how to identify event - ONCE AT WEEK?

Thanks!
[ March 07, 2007: Message edited by: Bear Bibeault ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41123
    
  45
The java.util.Timer and TimerTask classes can schedule events that occur in regular intervals (e.g., every 24 hours), or at specific points in time (e.g, every Friday night at midnight). See here for examples e367 and e368.


Ping & DNS - my free Android networking tools app
Pavels Hlopoks
Ranch Hand

Joined: Feb 05, 2007
Posts: 31
Thanks Ulf!
But how can I run something like this example on server?
When start app server must run something like servlet... or something else ,who looking for time
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41123
    
  45
Assuming you have a web app, you can run code at web app startup time by configuring a ServletContextListener and its contextInitialized method.
Pavels Hlopoks
Ranch Hand

Joined: Feb 05, 2007
Posts: 31
Cheers! Thanks! Good idea
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Regular mail sending on server application
 
Similar Threads
Bakup mail
Mail Server
JMF(ABOUT RTP TRANSMIT & RECEIVE) HELP!
changed e-mail
finding IP address