Tutorial :Debugging an SMTP Timeout Error



Question:

I'm working on a Rails project that utilizes Action Mailer to send out mail campaigns. For the moment I have been testing everything with a plain old GMail account. Getting closer to release now and I've decided to switch the smtp server to our local mail server.

This is all well and dandy until we attempt to actually send mail. With these new smtp server settings the mailer does nothing but time out:

MY_SMTP_SETTINGS = {    :address => 'oz.some.server.edu',    :port => 465,    :user_name => MY_USERNAME,    :authentication => :login,    :password => MY_PASSWORD  }  

This is the stack trace from the error I receive some time after trying to send a campaign:

    Timeout::Error: execution expired      from /opt/local/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'      from /opt/local/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'      from /opt/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'      from /opt/local/lib/ruby/1.8/net/protocol.rb:126:in `readline'      from /opt/local/lib/ruby/1.8/net/smtp.rb:911:in `recv_response'      from /opt/local/lib/ruby/gems/1.8/gems/ambethia-smtp-tls-1.1.2/lib/smtp-tls.rb:19:in `do_start'      from /opt/local/lib/ruby/1.8/net/smtp.rb:921:in `critical'      from /opt/local/lib/ruby/gems/1.8/gems/ambethia-smtp-tls-1.1.2/lib/smtp-tls.rb:19:in `do_start'      from /opt/local/lib/ruby/1.8/net/smtp.rb:525:in `start'      from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:681:in `perform_delivery_smtp'      from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `__send__'      from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `deliver!'      from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:395:in `method_missing'      from /Users/ryan/Development/gsoc/cohort/repo/app/models/freemailer_campaign.rb:39:in `send_campaign'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:364:in `method_missing_without_paginate'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `method_missing'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `each'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `send'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `method_missing'      from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:364:in `method_missing_without_paginate'      from /Users/ryan/Development/gsoc/cohort/repo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:167:in `method_missing'      from /Users/ryan/Development/gsoc/cohort/repo/app/models/freemailer_campaign.rb:37:in `send_campaign'  

Do anyone have any idea how I can pinpoint my problem?


Solution:1

Problem is not in ruby but in the email server. Make sure that the email server works (testing email server through telnet console) and try again.


Solution:2

Try telneting into the SMTP box.


Solution:3

Use telnet on your mail server on 465 port, if its not open, check firewall and the mail server configuration.Also you can try this for your actionmailer settings:

 :authentication => :plain (if so),   :enable_starttls_auto => true  


Solution:4

Known Ruby bug:

http://lindsaar.net/2007/12/9/rbuf_filltimeout-error


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »