background process for mail delivery

here's my problem:
I have a table with lots of emails to be sent at specified dates, and
I want a process that checks, let's say every hour or so, that table
for mails to be sent, sends them and delete the records...

A very simple background process that call's a method. If there was a
way of doing this not in background it'd be ok, I don't care if it
gets stuck every hour for a few seconds..

I know about remoterb, but really.. isn't there an easier way? I don't
want to spend too much time on this stuff!

thanks everyone!

That thing is too big! And it's meant for delivering mails like a
queue. I want to deliver them only when it's time, they might stay
there for months, years..
Is there a way that doesn't involve plugins, or just small ones?
like a stuff.. I don't know..


Is there some reason a cron job that POSTs an HTTP request to the Rails app
wouldn't do the trick?

Snaggy wrote:

Look at this.. I know it's a stupid try but I'd like to know why it
doesn't work:
put in some method.. do
  while true do
    sleep 30

Notifier is an action mailer class.
Shouldn't this send an email every 30 seconds? Can it access the
Notifies class?


where did my reply go ?!?

Anyway Bill, your idea sounds great, but how can I do it?

I have something that does exactly that.

It uses the Daemons gem. I start it by doing

ruby scripts/outgoing_email_thread.rb start/stop/restart

Basically this thread just loops forever. It wakes up and checks for
stuff to do by asking the database
"Notification.find(:all, :conditions => 'b_distribute = true').each do


So for me I have a table called Notifications that things get inserted
into by my application. If they want batch mode distribution, they
set b_distribute = true. This thing gets them, does some mojo and
then sends out notifications. Don't get caught up in my crazy code as
much as the idea of a Daemon thread you start that loops and does your
stuff. My app has about 4 of this bad boys running checking incoming
email, sending email, gathering SMS messages, etc.

#!/usr/bin/env ruby

you do this by using the SQL SSIS jobs also !!!

A cron task would also work...

You want ar_mailer...

"Even deliviring email to the local machine may take too long when you have to send hundreds of messages. ar_mailer allows you to store messages into the database for later delivery by a separate process, ar_sendmail."