开发者

switch to new server broke rails 2.2.2 app email

开发者 https://www.devze.com 2023-04-04 06:22 出处:网络
Moving to a new server broke all of my mailers in a rails 2.2.2 app. To debug this i created the simplest test email possible and continue to get an error.

Moving to a new server broke all of my mailers in a rails 2.2.2 app. To debug this i created the simplest test email possible and continue to get an error.

controller:

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

error msg:

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/L开发者_C百科ibrary/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"
}

version information:

  1. ruby 1.8.7 (same as prior server)
  2. rubygems version 1.3.6 (same as prior server)
  3. rails 2.2.2 (same as prior server)
  4. all gems are the same version as the prior server
  5. environment.rb, production, development and test configuration files are all exactly the same
0

精彩评论

暂无评论...
验证码 换一张
取 消