imap/tcp server failing (looping)
A common problem when running SquirrelMail on a moderately large site or bigger is that your IMAP server is regulated to only have a certain number of connections per minute. Below are different programs and how to counteract this phenomenon.
In the file /usr/lib/courier-imap/etc/imapd you can change the values of MAXPERIP and MAXDAEMONS to avoid dropped/refused connections. The same settings are also found in /usr/lib/courier-imap/etc/imapd-ssl but unless the IMAP server is not on the same server as SquirrelMail, there is no need to use SSL to connect to IMAP from within SquirrelMail.
The default number of connections is 50, but you might want to pump that up to 500, 10,000, or another large number. Just specify the number after the "wait" or "nowait", so that your line (assuming you want 500) would look something remotely like this:
imap stream tcp nowait.500 mail /bin/some/program/to/run -options
Again, change the number to suit your situation. See man inetd.conf for more information. (While you are there, check out DisablingTCPWrapper.)