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
--
Posted via http://www.ruby-forum.com/.
On 16 Jan ''06, at 8:36 PM, ray wrote:> 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 > endThat should be a subclass of ActionMailer::Base if you want to use it to send mail... --Jens -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060117/ecbf7bba/attachment.html
On Tue, 2006-01-17 at 05:36 +0100, ray wrote:> 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 >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 * ***************************************************************/