Traditional approach:
Depends on OS you can set up a scheduled task(cron job) that runs with a certain interval (I think it doesn't have to be very accurate, 3-5 minutes seems ok to me), grabs expired rows from the table, send emails and mark the records (I suggest adding email_status
column ) based on delivery status (success, failure, bounced, etc). You might want to add another column for storing mail server response.
Another option is more complex. You can write a native UDF that is capable of sending emails. Then you create recurring event that calls this function . It can be a good exercise, but may not be the best solution. Pros : completely done on server side, no client code required. Cons: creating and debugging native function can be a challenge, the function has to be uploaded to server instance, logic resides on database server