Trigger automatic email at certain time with java

3

My system has the part of dental consultations and I need to send email to the client, if your query is on that day.

For example: Automatically trigger an email trigger at midnight every day. This email trigger will check if you have queries that day and if you have, will send the email.

How do I run this check with java?

    
asked by anonymous 22.06.2017 / 00:43

1 answer

0

There are scheduling frameworks for tasks, however to just run a script daily you can use much simpler solutions. The operating systems have a task scheduler: in linux it has cron , in windows it has Agendador de Tarefas (name less creative, by the way).

Basically you create a java program that, when running, sends the emails with the queries, without worrying about the time. To schedule, you create a script like this:

@echo off
REM run the program
"C:\Program Files\Java\jdk1.7.0\bin\java.exe" -jar "C:\Users\User1    \Documents\project\emailConsulta.jar"

So just create a task in Windows Task Scheduler, accessed with Win + R > type "Taskschd.msc" > Enter. There you control which days of the week it will run, at what time, among other options.

    
22.06.2017 / 01:28