# Automated Mailer in Rails?

**URL:** <https://www.ruby-forum.com/t/automated-mailer-in-rails/120513>\
**Category:** Rails\
**Created:** [November 17, 2007, 7:56pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513 "2007-11-17T19:56:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [November 17, 2007, 7:56pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513/1 "2007-11-17T19:56:19Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [November 17, 2007, 8:06pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513/2 "2007-11-17T20:06:22Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [November 17, 2007, 8:07pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513/3 "2007-11-17T20:07:32Z")

</div>

> them.
> 
> Any ideas how I could do this automated mailing in Rails?

cron and script/runner

-philip

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [November 19, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513/4 "2007-11-19T21:59:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [November 19, 2007, 10:00pm UTC](https://www.ruby-forum.com/t/automated-mailer-in-rails/120513/5 "2007-11-19T22:00:47Z")

</div>

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](http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails)
