# Call Mailer from a script RoR

**URL:** <https://metaruby.com/t/call-mailer-from-a-script-ror/1520>\
**Category:** Ruby Questions\
**Created:** [February 9, 2018, 12:04am UTC](https://metaruby.com/t/call-mailer-from-a-script-ror/1520 "2018-02-09T00:04:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sakshik](https://metaruby.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@sakshik](https://metaruby.com/u/sakshik)\
**Post date:** [February 9, 2018, 12:04am UTC](https://metaruby.com/t/call-mailer-from-a-script-ror/1520/1 "2018-02-09T00:04:27Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![RubyRailsNinja](https://metaruby.com/letter_avatar_proxy/v4/letter/r/3bc359/32.png) [@RubyRailsNinja](https://metaruby.com/u/RubyRailsNinja)\
**Post date:** [April 1, 2018, 7:25am UTC](https://metaruby.com/t/call-mailer-from-a-script-ror/1520/2 "2018-04-01T07:25:11Z")

</div>

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 🙂
