Hi luda,
im sure not familiar with "hmailserver" - but if you have error log "A connection attempt failed because the connected party did not properly respond after a period of time"
1. check port 143 is open or not ?
2. check firewall for allow access tcp IMAP /* you can check manual telnet on localhost:143
3. set IMAP server running every booting
"my apache logs and there was no error reported either" apache not IMAP server
that a webserver