移动到新服务器在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"
}
版本信息: