Never used Java mail before.
In my JSF web app, I have an entity (followUp)
with a property private Date checkDate;
that corresponds to an
Based on your question history I know that you're using Glassfish 3 (Java EE 6 with EJB 3.1), so I'd suggest to create a @Singleton EJB with @Schedule method which executes in the background at specified intervals, for example daily at midnight (00:00:00).
@Singleton
public class MailReminder {
@Schedule(hour="0", minute="0", second="0", persistent=false)
public void run() {
// Do your check and mail job here.
}
}
That's it. No further configuration is necessary. For testing purposes you could use
@Schedule(hour="*", minute="*/1", second="0", persistent=false)
to let it run every minute.