2

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

我究竟做错了什么?

4

1 回答 1

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

于 2013-03-21T10:03:56.313 回答