Reputation: 619
Hi I need help regarding sending email periodically in Spring mvc,can anyone suggest which is the best way and how i can achieve this,
Upvotes: 1
Views: 7791
Reputation: 1012
There is a very good compatibility with Spring 3 + QuartZ Job Scheduler. Using QuartZ you can schedule a cron trigger which can easily send emails periodically and the best thing in this approach is, everything is very easy to implement and configurable. I would suggest you to please go through the below links:
Upvotes: 0
Reputation: 2327
If it has to be from inside the application, you could add a Spring @Scheduled
Service within it, and let this one send out your emails.
Akin to
// once every hour, on top of the hour, Mondays to Fridays
@Scheduled(cron = * 0 * * * MON-FRI)
public void sendMail() {
//mail stuff here
}
Upvotes: 3
Reputation: 2621
I would say that you would use a Quartz schedule to handle this. There is some documentation about scheduling tasks here:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html
Upvotes: 0
Reputation: 53705
Run scheduled tasks outside of your application. Use crontab or the like.
Upvotes: 0