Fetching email using Ruby on Rails

Posted by Shreyas Satish on Stack Overflow See other posts from Stack Overflow or by Shreyas Satish
Published on 2010-04-19T11:01:38Z Indexed on 2010/04/19 11:03 UTC
Read the original article Hit count: 457

Filed under:
|
|

I need to fetch email from my gmail account using RoR.

require 'net/pop' Net::POP3.start('pop.gmail.com', 995, username, password) do |pop|
if pop.mails.empty?
puts 'No mail.'
else
#pop.each_mail do |mail|
#p mail.header
#p mail.pop puts "Mails present" #end
end
end

I get a timeout error.

usr/lib/ruby/1.8/timeout.rb:60:in new': execution expired (Timeout::Error) from /usr/lib/ruby/1.8/net/protocol.rb:206:inold_open' from /usr/lib/ruby/1.8/net/protocol.rb:206:in old_open' from /usr/lib/ruby/1.8/net/pop.rb:438:indo_start' from /usr/lib/ruby/1.8/net/pop.rb:432:in `start' from script/mail.rb:4

Thanks and Cheers !

© Stack Overflow or respective owner

Related posts about email

Related posts about ruby-on-rails