Unable to send mail in rails 3. showing following message in browser.
Unknown action
The action 'method' could not be found for ActionMailer::Base
Here is the code I wrote.
- Notifier.rb
class Notifier < ActionMailer::Base default :from => "xxxxx@gmail.com" default_url_options[:host] = "localhost.com:3000"def welcome_email(user)
@user_email = user @url = root_url mail(:to => user.email, :subject => "Welcome to the site") end end
2.UsersController.rb
Notifier.welcome_email(@user).deliver
- application.rb
config.action_mailer.deliver_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'xxxxxxx.com',
:user_name => 'xxxx@gmail.com',
:password => 'xxxx',
:authentication => 'plain',
:enable_starttls_auto => true
}
Here is the log messages
AbstractController::ActionNotFound
(The action ‘method’ could not be
found for ActionMailer::Base):
app/mailers/notifier.rb:1:in<topcreate’
(required)>'
app/controllers/users_controller.rb:17:in
Rendered
C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb
within rescues/layout (0.0ms)
It’s
not
.
I happened to make the same typo in my configuration today.