Server side Script example

You want to check every day:-
For that you may want to use cron job, which calls your custom script everyday.

For the rest of the things, you can explore custom script, which is exposed in the form of webservice to the outside world. In that you can access your DB and do the logic check etc, and also can send email from the email service configured.

Hope that helps!