I solved the original problem here: it turns out that Apple Mail.app doesn't work with custom port numbers with SSL turned on. It accepts the change and doesn't complain, but there's a bug in the code that makes it fail silently when you have an IMAP SSL connection assigned to any port that isn't 993. So it's all up and running now.