"method_missing":未定义的方法"add_delivery_method"用于 ActionMailer::Base:Class



嗨,我正在尝试用一些数据初始化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
  }

你有没有看一下这个问题:使用Amazon SES与Rails ActionMailer?

相关内容

最新更新