titanous/mailman — pull request #51 by lgbr (2012-07-02 02:15:22+00:00)
Title: IMAP Receiver Crashes, Can't Set Port, Can't Set Folder, Can't Set SSL

In this pull request are some major improvements to the IMAP code.

The old version would crash on the second poll, since a connection was opened, but each poll calls 'connect', where it the IMAP code would reattempt login. In this version, I simply check if the connection is already open.

The second parameter to Net::IMAP#new should be a hash, rather than Fixnum. This allows setting the port as well as enabling SSL so that a user could use port 993.

Added an option for setting a folder other than INBOX.

The old version of this code called 'examine' rather than 'select' on a folder. The difference is that 'examine' opens the folder in read-only mode, which would raise an exception when the 'store' method was called to delete the read message.