ruby on rails - Mailer Broken from Controller -


so i've written mailer entitled usermailer containing method entitled test. method accepts 2 parameters: user (object) , recipient (email).

from console can send mailer command usermailer::deliver_test(user.find(1), 'email@email.com') , email sends successfully.

but if define same command or counterpart usermailer.test(user.find(1), 'email@email.com').deliver in users#mail, accessing action via users/mail returns nothing.

what have controller trigger delivery properly?

you need call mailer's class method inside controller

usermailer.deliver_test(user.find(1), 'email@email.com') 

or user's instance method:

usermailer.deliver_test(self, 'email@email.com') 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -