Emailing: How to execute "ar_sendmail" using "RailsCron"


#1

Hi there,

I’d like to know how to get “ar_sendmail” (a command from the gem
“ar_mailer”) executed using the plugin “RailsCron”:

FYI: “RailsCron” is a way to execute background tasks using your Ruby on
Rails environment. The RailsCron object is an ActiveRecord, so you can
manipulate it in familiar ways:

RailsCron.create(
:command => “Object.do_something()”,
:start => 2.minutes.from_now,
:every => 12.hours, # default: 1.day
:finish => 2.years.from_now # optional
)

I know that “ar_sendmail” is a command that could be executed
a) manually, using the command line (at the root of the rails app), or
b) automatically, using a conventional cron job.

But how do I write the code to have “ar_sendmail” executed from within
my RoR environment (as in the code above)?

Thanks for any solutions & sorry for being a n00b :wink: !
Tom