[英]Timeout error for tlsmail for sending mail via devise and action_mailer
我目前正在嘗試將應用程序部署到具有以下規格的65位centos vm:
rvm 1.13.8
ruby 1.9.3p194
OpenSSL 1.0.1e-fips
我正在使用Apache,Capistrano和Phusion乘客
我的/config/environments/production.rb有以下幾行
Net::SMTP.enable_tls(OpenSSL:SSL::VERIFY_NONE)
config.action_mailer.default_url_options = { :host => MY URL }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
address: "smtp.gmail.com",
port: 587,
domain: "gmail.com",
authentication: "plain",
user_name: "MyGMAILEMAIL@gmail.com",
password: ENV["GMAIL_PASS"]
}
我的開發環境使用完全相同的設置,但更改的主機設置為我的gloabl IP。
為了獲得良好的效果,我的開發統計信息(32位ubuntu VM):RVM 1.25.19 ruby 1.9.3p545 OpenSSL 1.0.0e
我的開發環境非常適合發送電子郵件,但這就是讀取/ var / log / httpd / error_log文件時得到的
App 4738 stdout: Started POST "/users" for MY IP at 2014-03-14 21:11:29+0300
App 4738 stdout: Processing by Devise::RegistrationsController#create as HTML
App 4738 stdout: Parameters: {"utf8"=>"√", "authenticity_token"=>"9CGdegNfbYkPljo1Rx/VLngfrhCLlw9IpKfPwm/uCuo=", "user"=>{"email"=>"MY EMAIL", "password"=>"[FILTERED]", "password_confirmation"=>[FILTERED]"}, "commit"=>"Signup"}
App 4676 stderr: [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
App 4676 stderr:
App 4738 stdout: Rendered devise/mailer/confirmation_instructions.html.erb (1.1ms)
App 4738 stdout:
App 4738 stdout: Sent mail to my EMAIL (30018.6ms)
App 4738 stdout: Completed 500 Internal Server Error in 31220ms
App 4738 stdout:
App 4738 stdout: Timeout::Error (execution expired):
App 4738 stdout: tlsmail (0.0.1) lib/net/smtp.rb:454:in `initialize'
App 4738 stdout: tlsmail (0.0.1) lib/net/smtp.rb:454:in `open'
App 4738 stdout: tlsmail (0.0.1) lib/net/smtp.rb:454:in `block in do_start'
App 4738 stdout: tlsmail (0.0.1) lib/net/smtp.rb:454:in `do_start'
App 4738 stdout: tlsmail (0.0.1) lib/net/smtp.rb:440:in `start'
App 4738 stdout: mail (2.5.4) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
App 4738 stdout: mail (2.5.4) lib/mail/message.rb:2129:in `do_delivery'
App 4738 stdout: mail (2.5.4) lib/mail/message.rb:232:in `block in deliver'
App 4738 stdout: actionmailer (4.0.2) lib/action_mailer/base.rb:456:in `block in deliver_mail'
我跑步時注意到的東西
telnet smtp.gmail.com 587
在我的開發VM上:
trying 74.125.196.108
connected to gmail-smtp-msa.l.google.com
和我的生產VM:我得到
trying 74.125.196.108
它掛在那里,沒有確認,只是掛在那里而沒有任何反應。
好吧,我想通了。 如果有人有任何類似的問題,我會把它放在這里
運行ping smtp.gmail.com並找到IP地址
然后在您的服務器上運行csf -a {IP地址}
那應該允許您的應用程序訪問gmail smtp服務器
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.