I have a rails project that I would like to set up email notifications for. For example, if record X expires in 5 days, send an email to the owner. I have email notifications set up when new users register but can’t figure out how to send email based on a conditional (if x = y, then send email). Please help!!
Share
You can use rake tasks for it. Set it in cron to execute once a day.
Example rake task code you can modify and use:
Make new bash script, put it wherever you want:
Use
crontab -eto add your task to crontab. Add this line:It will execute it each day at midnight.
Remember to set chmod +x to the script!