Невозможно отправить почту в rails 3. В браузере отображается следующее сообщение.
Unknown action
The action 'method' could not be found for ActionMailer::Base
Вот код, который я написал.
- Notifier.rb
class Notifier < ActionMailer::Base
default :from => "[email protected]"
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
- приложение.rb
config.action_mailer.deliver_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'xxxxxxx.com',
:user_name => '[email protected]',
:password => 'xxxx',
:authentication => 'plain',
:enable_starttls_auto => true
}
Вот сообщения журнала
AbstractController::ActionNotFound (не удалось найти «метод» действия для ActionMailer::Base):
app/mailers/notifier.rb:1:in<top (required)>'
create'
app/controllers/users_controller.rb:17:inВизуализировано C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb в файле Rescues/layout (0,0 мс)