Forum: Ruby on Rails actionmailer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F2b90f5ca602f5c3272d6ee21784c27a?d=identicon&s=25 ray (Guest)
on 2006-01-17 05:36
I'm getting an error when I'm tyring to use the actionmailer.
undefined method `deliver_signup_thanks' for Notifier:Class

This is what I have in the controller.
  def emailTest
    Notifier::deliver_signup_thanks()
    render_text "email test"
  end


This is what I have in notifier model (notifier.rb)
class Notifier < ActiveRecord::Base
  def signup_thanks()
    # Email header info MUST be added here
    @recipients = "test@test.com"
    @from = "accounts@mywebsite.com"
    @subject = "Thank you"

    # Email body substitutions go here
    # @body[â??first_nameâ?] = user.first_name
    # @body[â??last_nameâ?] = user.last_name
  end
end

This is what I have in environment.rb
ActionMailer::Base.server_settings = {
  :address => "smtp.postoffice.net",
  :port => 25,
  :domain => "www.test.us",
  :user_name => 'test',
  :password => 'test',
  :authentication => :login
}

Can anyone see anything wrong here?  Appreiciate the help. Thanks
Edbd5f1c2f535b14165ae883fa7c3f37?d=identicon&s=25 Jens Alfke (Guest)
on 2006-01-17 06:35
(Received via mailing list)
On 16 Jan '06, at 8:36 PM, ray wrote:

>     # @body[â??last_nameâ?] = user.last_name
>   end
> end

That should be a subclass of ActionMailer::Base if you want to use it
to send mail...

--Jens
B84d42a3a5c343f8fc6ab7d7f47fd3f5?d=identicon&s=25 Robby Russell (Guest)
on 2006-01-17 09:11
(Received via mailing list)
On Tue, 2006-01-17 at 05:36 +0100, ray wrote:
> This is what I have in notifier model (notifier.rb)
>   end
> }
>
> Can anyone see anything wrong here?  Appreiciate the help. Thanks
>

You might try to do the following:

./script/generate mailer Notifier signup_thanks

Then look at the files it generated and compare to yours. :-)

-Robby

--
/**************************************************************
* Robby Russell, Founder & Executive Director                 *
* PLANET ARGON, LLC | www.planetargon.com                     *
* Ruby on Rails Development, Consulting, and Hosting          *
* Portland, Oregon  | p: 503.351.4730 | f: 815.642.4068       *
* blog: www.robbyonrails.com | book: www.programmingrails.com *
***************************************************************/
This topic is locked and can not be replied to.