[英]undefined method `async=' for ActionMailer::Base:Class in rails 4
[英]Rails 3 “The action 'method' could not be found for ActionMailer::Base”
无法在rails 3中发送邮件。在浏览器中显示以下消息。
Unknown action
The action 'method' could not be found for ActionMailer::Base
这是我写的代码。
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
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(无法在ActionMailer :: Base中找到操作'method'):
app / mailers / notifier.rb:1:in<top (required)>'
app/controllers/users_controller.rb:17:in<top (required)>'
app/controllers/users_controller.rb:17: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(0.0ms)
它的
config.action_mailer.delivery_method
不
config.action_mailer.deliver_method
。
我今天在配置中遇到了相同的拼写错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.