嗨,我正试图用一些数据初始化ActionMailer::Base:类:

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/

10-11 20:45