Mail Fetcher : TCPSocket.open issue


#1

Hi All,

I want to featch mails from gmail using rails. Am following
http://www.iannopollo.com/articles/2008/02/17/mail-fetcher---fetch-email-from-ruby-and-rails/
link for that. But am getting an error.

Timeout::Error (execution expired):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:54:in
open' ./vendor/plugins/mail-fetcher/lib/net/pop.rb:519:indo_start’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:56:in
timeout' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:76:intimeout’
./vendor/plugins/mail-fetcher/lib/net/pop.rb:522:in do_start' ./vendor/plugins/mail-fetcher/lib/net/pop.rb:508:instart’
./vendor/plugins/mail-fetcher/lib/net/pop.rb:383:in start' /app/controllers/users_controller.rb:128:infetch_mail’
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
send' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:inperform_action_without_filters’

I have downloaded mail-fetcher plugin and added it in my controller file
(require ‘vendor/plugins/mail-fetcher/lib/mail_fetcher.rb’). But its
getting stuck here.

Net::POP3.start(“mail.google.com”, nil, “username”, “password”) do |pop|
and s = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
(pop.rb:519)

When i tried with irb its gave me this error

Apples-iMac-Vipin:~ vipin$ irb

require ‘socket’
=> true

require ‘open-uri’
=> true

s = TCPSocket.open(“gmail.com”, 587) ; s.close
Errno::ETIMEDOUT: Operation timed out - connect(2)
from (irb):3:in initialize' from (irb):3:inopen’
from (irb):3

Any ideas?