Mailer Strategy

Hi all. First let me say thanks for being such a patient and helpful
bunch. I’m a .NET developer by day, but since I discovered Rails I’m
having a tough time waking up and going to work (as I stay up so late
working on Rails projects ; ) ). You all are a large part of why I
enjoys Rails so much. So thanks!

I’m running into a bit of a snag with a Rails app I’m building. I need
to have a nightly (cron) job that will send off emails to customers
with an attached CSV file. I’m struggling with how to implement it.

Since it’s a Rails app, I started using ActionMailer and make it a
page in the app, but it could potentially timeout as the app grows.
I’ve also thought about a single .rb file that I could call from a
cron job that would process and send the mail. Unfortunately, I don’t
have much Ruby experience outside Rails and wasn’t sure how to best
pull that off. I’ll still like to utilize the application models and
views. Any guidance would be greatly appreciated.

Thanks!

–Ryan

script/runner let’s you run Rails apps without the browser environment.

It’s just what you need.


– Tom M.

Thanks for the response. I how to call a model from runner, but how
would you render a view? I’m currently creating the attached file in a
view for a manually run report. I need to render the same view, but
attach it to an email. Can that be done through runner?

–Ryan