切换到新服务器破坏了rails 2.2.2 app email

时间:2011-09-09 13:02:00

标签: ruby-on-rails actionmailer

移动到新服务器在rails 2.2.2 app中打破了我的所有邮件程序。为了调试这个,我创建了最简单的测试电子邮件,并继续出错。

控制器:

def send_new_password
  @login = params[:login]
  @user = User.find_by_login(@login)
  UserMailer.deliver_new_password(@user) # line cited in the error msg
  redirect_to login_path
end

user_mailer.rb:

class UserMailer < ActionMailer::Base
  def new_password(user)
    recipients  user.email
    from        "service@ourdomain.com"
    subject     "New Password from ourdomain.com"
    body        "test test"
  end
end

错误消息:

wrong number of arguments (3 for 2)

vendor/plugins/action_mailer_tls/lib/smtp_tls.rb:8:in `check_auth_args'
vendor/plugins/action_mailer_tls/lib/smtp_tls.rb:8:in `do_start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:671:in `perform_delivery_smtp'
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:526:in `__send__'
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:526:in `deliver!'
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.2.2/lib/action_mailer/base.rb:392:in `method_missing'
app/controllers/home_controller.rb:87:in `send_new_password'

environment.rb中:

ActionMailer::Base.smtp_settings = {
  :address => "smtp.ourmailserver.com",
  :port => 25,
  :domain => "ourmailserver.com",
  :authentication => :plain,
  :user_name => "service@ourdomain.com",
  :password => "ourpassword"
}

版本信息:

  1. ruby​​ 1.8.7(与之前的服务器相同)
  2. ruby​​gems版本1.3.6(与之前的服务器相同)
  3. rails 2.2.2(与之前的服务器相同)
  4. 所有gems与先前服务器的版本相同
  5. environment.rb,生产,开发和测试配置文件都完全相同

1 个答案:

答案 0 :(得分:0)

这是一个缺少的插件。请参阅此article