我正在使用resque_mailer和mandrill_api为我的rails应用程序发送邮件。邮件在开发模式下交付,但在生产模式下,我收到 Net :: OpenTimeout 错误。完整的错误日志是:
/usr/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize'
/usr/lib/ruby/2.1.0/net/smtp.rb:541:in `open'
/usr/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket'
/usr/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start'
/usr/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
/usr/lib/ruby/2.1.0/timeout.rb:101:in `call'
/usr/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
/usr/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start'
/usr/lib/ruby/2.1.0/net/smtp.rb:520:in `start'
/opt/gem/ruby/2.1.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
/opt/gem/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
/opt/gem/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
/opt/gem/ruby/2.1.0/gems/actionmailer-4.1.14/lib/action_mailer/base.rb:527:in `block in deliver_mail'
/opt/gem/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notifications.rb:159:in `block in instrument'
/opt/gem/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/gem/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notifications.rb:159:in `instrument'
/opt/gem/ruby/2.1.0/gems/actionmailer-4.1.14/lib/action_mailer/base.rb:525:in `deliver_mail'
/opt/gem/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
/opt/gem/ruby/2.1.0/gems/resque_mailer-2.2.7/lib/resque_mailer.rb:49:in `perform'
我在production.rb中的smtp设置是
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { host: "localhost:3000" }
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 2525,
:domain => ENV['domain'],
:user_name => ENV['username'],
:password => ENV['password'],
:authentication => "plain",
:enable_starttls_auto => true
}
我做错了什么?提前谢谢。