ActionMailer Automatically sends an email everyday at a specific time.


I would like to have a notification system where an email is sent to
specific addresses every morning with different contents everyday. The
contents are stored in the data, but the number of recipients is a
few. So, it's not a gigantic task.

I will be using ActionMailer on Rails 2.0.2, but I can't come up with
a way to trigger the method to send the emails at a given time
everyday. If my understanding is correct, Unix has a cron job, so I
could use that, though that is not beyond the territory of Rails. Is
there any easier way to do that in Rails? Or would you recommend me
that I use a cron job for this?

- T

You can either use cron and a standalone rails script that partially
loads some of the rails stuff and does it's thing, or you can write a
standalone ruby script that simply sleeps and wakes up every minute or
so and runs when it's the correct time (or close to it). You can
always use a daemon gem so that it keeps itself alive in case of
random crashes.

Cron/Ruby advantage: