[Rails] ActionMailer
Nicholas Wieland
nicholas_wieland at yahoo.it
Fri Jan 7 15:33:57 GMT 2005
Hi all, I have a few problems with ActionMailer.
First of all, I've used the script/generate mailer Norifier command, and
it hasn't created the view, just the model: from what I understand it
should at least create an app/views/notifier/ directory, but I'm not
sure ...
BTW, I've followed the howto and I can't make it work:
# app/model/notifier.rb
class Notifier < ActionMailer::Base
def registration_mail(to, user, password)
@recipients = to
@from = "nicholas_wieland at yahoo.it"
@subject = "Hi"
@body = password
end
end
This is how I use it in my controller:
if @user.save
Notifier.registration_mail(
@params['new_user']['email'],
@params['new_user']['username'],
@params['new_user']['password'])
redirect_to :action => "registration_message"
The view (app/views/notifier/registration_message.rhtml, I've created it
by hand ...) is a simple test message, I just want to try out the whole
thing. I'm sure that the method inside the controller is called because
it redirects me to "registration_message". I've looked at my MTA logs
and nothing has been sent.
Do I have to require something inside the controller ?
TIA,
ngw
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
More information about the Rails
mailing list