Call Mailer from a script RoR


#1

I have a rails application myrails.
I have generated a UserMailer. It created:

  1. myrails/app/mailers/user_mailer.rb
  2. placeholder for templates of mails: myrails/app/view/user_mailer/…’

I wrote an action in user_mailer.rb and the corresponding template in myrails/app/view/user_mailer/. I am able to call UserMailer method from any controller in myrails/app/controllers/ but I am not able to call UserMailer from myrails/bin/myscript.rb . Is it possible to do that ?


#2

Hi

why do you want to call mailer within a script ?

Is it scheduled or something like that ?

You can find the right way to call your script from model or controller …

tell us more please :slight_smile: