Add retry logic to IMAP receiver connection

This cherry-picks the commit a7f0501d5576a2cd38cab300629353028ec99e10 from the
fork at https://github.com/sprucemedia/mailman. This doesn't apply cleanly
to our backported fork, so resolved by this commit
Added retry logic to polling loop for common nondeterministic responses from generic servers. Ref #74.