Ruby Net::IMAP library provides a good API for IMAP stuff (http://railsapi.com/doc/ruby-v1.8/classes/Net/IMAP.html). There are two methods related to closing the IMAP connection: logout() and disconnect(). In which turn are they supposed to be called?
A:
logout
will simply log the user out of the server while disconnect
will completely close the socket. I would use logout if you want to keep the connection open (like maybe logging into another mailbox using the same socket) and disconnect when you don't need to do anymore work with the IMAP server. As for a sequence, logout should be used before disconnect.
Brian
2010-07-23 21:41:07
Thanks. That's exactly how I thought.
Ivan Kataitsev
2010-07-24 19:59:10