我正在使用 AWS SES 在我的 Rails 4 Web 应用程序中向客户发送通知电子邮件。发送电子邮件时,我意识到由于 SES 中的 SMTP 超时错误,多次发送电子邮件失败。最后,经过一些重试后,发送了电子邮件,但我不希望这些重试。
我不需要更改我的应用程序中的任何内容,以便可以发送电子邮件,它在重试后可以工作。
我附上错误日志:
{ 70220114991960 rufus-scheduler intercepted an error:
70220114991960 job:
70220114991960 Rufus::Scheduler::EveryJob "60s" {}
70220114991960 error:
70219770058060
70219770058060 Net::OpenTimeout
70219770058060 execution expired
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `open'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:520:in `start'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `block in deliver'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:456:in `block in deliver_mail'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:454:in `deliver_mail'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `deliver'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/app/models/notification_manager.rb:40:in `notify'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/app/models/events/boat_provider_payment_event.rb:104:in `execute'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/app/models/secretary.rb:87:in `block in executeEvents'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/app/models/secretary.rb:20:in `each'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/app/models/secretary.rb:20:in `executeEvents'
70219770058060 /home/ubuntu/env/test/www/yanpyapi-test/config/initializers/task_scheduler.rb:9:in `block in <top (required)>'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:224:in `call'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:224:in `do_trigger'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:269:in `block (3 levels) in start_work_thread'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:272:in `call'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:272:in `block (2 levels) in start_work_thread'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:258:in `loop'
70219770058060 /home/ubuntu/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rufus-scheduler-3.0.3/lib/rufus/scheduler/jobs.rb:258:in `block in start_work_thread'
} 70219770058060 .
最佳答案
看起来它只是通过更改我的 Rails 应用程序中的 SMTP 端口配置来工作。我将端口更改为 587。
关于ruby-on-rails - 亚马逊网络服务 SES smtp 超时,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28084728/