`method_missing':ActionMailer :: Base的未定义方法`add_delivery_method':Class

时间:2013-03-21 09:53:44

标签: ruby-on-rails ruby ruby-on-rails-3 actionmailer

您好我正在尝试使用一些数据初始化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

我做错了什么?

1 个答案:

答案 0 :(得分:2)

最有可能的是,您要做的事情应该是在环境文件中,即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