IF your mail server has shut down (depending on what system you have) you may get it to startup with a simple
A) service courier-imap start
B) login to your control panel and restart the entire mail server
C) reboot the box - perhaps your pop/mail daemon died.
Not sure what you run so one of the above 3 should do the trick. Doesn't sound entirely like its a firewall issue to me - but if it is the quickest check is just shut off iptables for a second and re-check.
█ TurnKey Internet, Inc : phone 1.518.618.0999 and 1.877.539.4638 | Contact Us
█ Cloud Servers | Dedicated Servers | Colocation | VPS | Mail Services | Reseller hosting
█ New York / East Coast Green Datacenter