Невозможно отправить почту в рельсах 3. Отображение следующего сообщения в браузере.
Unknown action
The action 'method' could not be found for ActionMailer::Base
Вот код, который я написал.
- Notifier.rb
class Notifier < ActionMailer::Base
default :from => "xxxxx@gmail.com"
default_url_options[:host] = "localhost.com:3000"</p>
<p>def welcome_email(user)<br>
@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
}
Вот сообщения журнала
AbstractController :: ActionNotFound («Action» метод не найден для ActionMailer :: Base):
app / mailers / notifier.rb: 1: in <top
(required)>'<br>
app/controllers/users_controller.rb:17:in
create '
Rendered 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.0ms)