I have Windows server with PostgreSQL database. I stored in the database employees data including contract expiry date.
I would like to send an automatic email for each employee 30 days before the expiry date. (Each employee has an email account).
What is the best way to do that?
I am thinking to do the following, Could you please advise if it is the best way, and if, I need answer for the questions:
- Build WinForm C# application doing:
-
Access PostgreSQL everyday( I know how to deal with Postgresql, but
how to make it per each new day (schedule task?)?) -
Compare machine date with all expiry date in the database
- If the difference equals or less than 30 days, an automatic mail will
be send to the employee. (how to send emails using C#}
AS @Middas proposed, writing a simple console application would take the responsibility of scheduling outside the application.
A simple console application is OK, scheduled by either Windows Scheduler or a 3rd party scheduler would do.
For sending emails, you could