1

我所有的邮件代码都运行良好,直到我决定是时候将发送电子邮件的地址更改为生产电子邮件(到目前为止,我一直在使用我的个人 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  
}

我尝试更改身份验证类型和其他几个属性,但没有任何效果。

4

0 回答 0