您好,我正在尝试使用一些数据初始化 ActionMailer::Base:Class:
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
:access_key_id => '0PxxxxxxxxxxxxS8Dyyy',
:secret_access_key => 'aJxxxxxxxxxxxxx2Tpppa+ZQ6dddddddkN2'
但这会引发错误:
`method_missing': undefined method `add_delivery_method' for ActionMailer::Base:Class (NoMethodError)
我的 Rails 版本 - 3.2.13
我做错了什么?
最佳答案
最有可能的是,您尝试执行的操作应该在环境文件中,即 config/environments/Production.rb
。这样做:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "email-smtp.us-east-1.amazonaws.com",
:user_name => "..." # Your SMTP user here.
:password => "...", # Your SMTP password here.
:authentication => :login,
:enable_starttls_auto => true
}
您是否看过这个问题:Using Amazon SES with Rails ActionMailer ?
关于ruby-on-rails - `method_missing' : ActionMailer::Base:Class 的未定义方法 `add_delivery_method',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15544172/