Forum: Ruby on Rails IMAP disconnect method broken?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3dda2c76123692d982b648851f710269?d=identicon&s=25 Bealach Na Bo (Guest)
on 2006-04-25 09:21
(Received via mailing list)
I'm using the standard Net::IMAP and OpenSSL libraries to connect to
an IMAP server.
I can connect, examine and manipulate my INBOX, but when call the
disconnect method of the imap instance it just hangs. The minimal
version is almost identical to
the example on page 701 of "Programming Ruby". Should I be calling
some other method?


require 'net/imap'
require 'openssl'
server, login, password = 'imap.server','my_login','my_password'
imap = Net::IMAP::new(server, 993, true)
imap.login(login,password)
imap.examine('INBOX')
puts "Message count: #{ imap.responses["EXISTS"]}"
imap.search(["To", "Me"]).each do |message_id|
  envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
  puts "#{envelope.from[0].name}: \t#{envelope.subject}"
end
imap.disconnect



Regards,

Bealach
This topic is locked and can not be replied to.