2010-08-02 3 views
2

메신저 액션 메일러와 이메일을 보내려고 그리고 그것은 나에게주는 Timeout::Error (execution expired):는 전자 메일이 전송되는 것을 말한다 콘솔에서 비록 : 는Actionmailer "Timeout :: Error"에 문제가 있습니까?

Sent mail to [email protected] 

다음 다음 전송 된 전자 메일을 디스플레이의 표시

config.cache_classes = false 
config.whiny_nils = true 
config.action_controller.consider_all_requests_local = true 
config.action_view.debug_rjs       = true 
config.action_controller.perform_caching    = false 

config.action_mailer.raise_delivery_errors = true 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.smtp_settings = { 
    :enable_starttls_auto => true, 
    :address    => "smtp.gmail.com", 
    :port     => 587, 
    :domian    => "gmail.com", 
    :authentication  => :login, 
    :user_name   => "username", 
    :password    => "blablabla", 
} 

나는 또한 TR : 여기

Timeout::Error (execution expired): 
    /usr/lib/ruby/1.8/timeout.rb:60:in `open' 
    /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start' 
    /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start' 
    /usr/lib/ruby/1.8/net/smtp.rb:525:in `start' 
    app/models/appointment.rb:10:in `tomorrows_appointments' 
    app/models/appointment.rb:8:in `each' 
    app/models/appointment.rb:8:in `tomorrows_appointments' 
    app/controllers/show_appointments_controller.rb:11:in `send_email' 
    -e:2:in `load' 
    -e:2 

Rendered rescues/_trace (35.8ms) 
Rendered rescues/_request_and_response (0.3ms) 
Rendering rescues/layout (internal_server_error) 

내 설정이다 : 그것은 다음과 같은 오류를 보여줍니다 authentication:plain으로 설정하고 [email protected]을 희망없이 사용하는 user_name으로 설정하십시오.

아이디어

답변

1

SMTP 요청은 아마 당신이 시간 제한에 설정 한 시간에 따라, 가끔 시간이 초과 할 것으로 보인다. 다른 문제는 사용자가 서버가 Gmail의 SMTP 서버와 통신하기를 기다리는 동안 웹 앱이 지연되는 것입니다.

Gmail이 새로운 레일 앱에 널리 사용되는 옵션이라는 것을 알고 있지만 일일 전송 한도가있는 특정 Gmail 계정을 통해 메일을 보내야하므로 장기적인 솔루션이라고 생각하지 않습니다. 그리고 다른 계정을 사용해도 SMTP 시간 초과가 문제라는 것을 알았습니다.

이제 SendGrid를 사용하여 전자 메일을 보내고 postgrid를 통해 sendgrid를 릴레이 호스트로 사용하는 것이 유리한 옵션이라는 것을 알았습니다. 즉, 사용자가 웹 응용 프로그램의 응답을 더 빨리 가져오고 메일이 postfix를 통해 대기 한 다음 sendgrid를 통해 전송됩니다 (더 이상 시간 제한 없음).

는 sendgrid의 후위 설치 지침에 대해서는 여기를 참조하십시오 :

config.action_mailer.delivery_method = :sendmail 
config.action_mailer.sendmail_settings = { 
    :location  => '/usr/sbin/sendmail', 
    :arguments  => '-i -t' 
} 
3

내가 거기에 오타를 보았다 : 당신이 을 쓴 http://wiki.sendgrid.com/doku.php?id=postfix

그런 다음 레일 환경에서, 당신은 단지 다음과 같은 뭔가가 필요 : domian => "gmail.com"

대신

: 도메인 => " gmail.com ",

다른 사람이 같은 문제가 경우
1

:

방화벽이 iptables에, 당신은 모든 기존 규칙을 나열 할 수 있습니다를 들어 포트 587

나가는 연결을 허용하는지 확인을 :

sudo iptables -L 

은 필요한 규칙에 대한 모양이 here입니다.

AWS 인스턴스을 사용하는 경우 보안 그룹을 살펴보십시오.