Hi, i’ve got a problem.
I’ve setup my rails app to send mail, say when someone registers they
get a ‘hey thanks for registering’ email; that works fine.
That’s firing thru using sendmail ok.
Next up I’ve got a facility for people to set reminders, say for
birthdays.
So to remind these people I’d like something to run maybe daily and when
it sees someone’s birthday is coming up fire off an email to remind
them.
Any ideas how I could do this automated mailing in Rails?
Appreciate any help or pointers you geniuses have on this.
John.
(p.s. beers are on me if we ever meetup)
Write a ruby script that calls a URL that returns all the birthdays
each user has saved. Then check if any are soon and call a url on your
site that sends email with the user and birthday parameters. You would
run this script as a daily cron job.
Does that get you started?
On Nov 17, 10:56 am, John G. [email protected]
Philip H. wrote:
them.
Any ideas how I could do this automated mailing in Rails?
cron and script/runner
-philip
excellent idea.
makes perfect sense when you think about it. write a ruby script to go
thru and return all users and reminders valid for sending at the current
day; then iterate thru the collection emailing reminders out till you
get to the bottom of the array.
now couple that with cron and the script/runner to run the ruby script
when you need to.
thanks Phillip and eggie5, helps a lot.
sincerely,
John.
John G. wrote:
Philip H. wrote:
them.
Any ideas how I could do this automated mailing in Rails?
cron and script/runner
-philip
excellent idea.
makes perfect sense when you think about it. write a ruby script to go
thru and return all users and reminders valid for sending at the current
day; then iterate thru the collection emailing reminders out till you
get to the bottom of the array.
now couple that with cron and the script/runner to run the ruby script
when you need to.
thanks Phillip and eggie5, helps a lot.
sincerely,
John.
p.s. found a link…
http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails