更改smtp设置后,actionmailer崩溃

时间:2013-03-04 19:58:15

标签: ruby-on-rails

我的所有邮件代码都运行正常,直到我决定将电子邮件发送到生产电子邮件的时间(我之前一直使用我的个人Gmail帐户进行测试)。

当我进行切换时,我开始获得带有以下堆栈跟踪的TypeError

TypeError: can't convert Symbol into Integer
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:575:in `initialize'
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:575:in `new'
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:575:in `ssl_socket'
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:580:in `tlsconnect'
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:560:in `do_start'
from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:519:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
from /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'
from /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'
from /app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.11/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `block in instrument'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `instrument'
from /app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.11/lib/action_mailer/base.rb:413:in `deliver_mail'
from /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
from (irb):1
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'

唯一能在完美工作和获得上述堆栈跟踪之间发生变化的是smtp设置的变化。这是我之前和之后的smtp设置(当然不包括敏感信息)

之前(使用Gmail帐户):

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "www.domain.com",
  :user_name            => "username",
  :password             => "password",
  :authentication       => :plain,
  :enable_starttls_auto => true  
}

之后(不是gmail帐户):

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.domain.com",
  :port                 => 587,
  :domain               => "www.domain.com",
  :user_name            => "username",
  :password             => "password",
  :authentication       => :login,
  :openssl_verify_mode  => :none,
  :enable_starttls_auto => true  
}

我尝试更改身份验证类型和其他一些属性,但没有任何工作。

0 个答案:

没有答案