Używam Ruby MRI 2.0.0 i Rails 3.2.12 na Ubuntu 12.04 TLS VPS i próbuję skonfigurować powiadomienia e-mail w mojej aplikacji. To działało dobrze kilka dni temu, ale już nie. Mój usługodawca internetowy to OVH.Rails Mailer "Net :: OpenTimeout: wykonanie wygasło" Wyjątek na serwerze produkcyjnym
Moje ustawienia SMTP:
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => '[email protected]',
:password => 'secret',
:authentication => 'plain',
:enable_starttls_auto => true
}
Korzystanie RAILS_ENV=production rails console
:
class MyMailer < ActionMailer::Base
def test_email
sender = "[email protected]"
receiver = "[email protected]"
mail from: sender, to: receiver, subject: "Hello!", body: "World!!"
end
end
=> nil
MyMailer.test_email.deliver
Wyjście:
Net::OpenTimeout: execution expired
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `tcp_socket'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:550:in `block in do_start'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:549:in `do_start'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:519:in `start'
from ~/.rvm/gems/[email protected]/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
from ~/.rvm/gems/[email protected]/gems/mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'
from ~/.rvm/gems/[email protected]/gems/mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'
from ~/.rvm/gems/[email protected]/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from ~/.rvm/gems/[email protected]/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
from ~/.rvm/gems/[email protected]/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from ~/.rvm/gems/[email protected]/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `instrument'
from ~/.rvm/gems/[email protected]/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:413:in `deliver_mail'
from ~/.rvm/gems/[email protected]/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
from (irb):28
from ~/.rvm/gems/[email protected]/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from ~/.rvm/gems/[email protected]/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from ~/.rvm/gems/[email protected]/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'2.0.0p0 :029 >
Próbowałem następujące:
- Klejnot
exception_notification
został dodany do instalacji kilka dni temu. Próbowałem skomentować jego linię wGemfile
, a także jej zgodną konfigurację i uruchomićbundle install
. Po ponownym uruchomieniu serwera problem nadal występuje, nawet jeśli usunę go i ponownie utworzy go. - przetestować go na maszynie wirtualnej (dokładnie to samo ustawienie jak VPS tym regułami iptables): pracuje
- Wyłącz iptables zasady: nie działa
- Ręczne łączenie Gmail z VPS wykorzystaniem OpenSSL: działa (więc nie jest to problem z zaporą ogniową - patrz tutaj: Connecting to smtp.gmail.com via command line);
- Włącz IMAP w opcji konta Gmail (było wyłączone): nie działa
- użyć innego konta Gmail: nie działa
- Wymień Ruby 2.0.0 Ruby 1.9.3 przez
- Uaktualnij do szyn 3.2.13
Czy ktoś ma możliwą wskazówkę, jak rozwiązać ten problem?
Dzięki!
Oto kolejny przejaw: wykonanie upłynął /ree-187/lib/ruby/1.8/timeout.rb:64:in 'open ' .../vendor/plugins/action_mailer_optional_tls/lib/sm tp_tls.rb: 40: in 'do_tls_start ' /.../vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb:40:in' do_tls_start' ... – rogerdpack