Why not tunnel the IMAP connection through SSH? SSH has great support for port forwarding. I use it all the time. -Josh