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.
ray (Guest)
on 2006-01-17 06: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 = "removed_email_address@domain.invalid"
    @from = "removed_email_address@domain.invalid"
    @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
Jens A. (Guest)
on 2006-01-17 07: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
Robby R. (Guest)
on 2006-01-17 10: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 R., 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.