I think the problem has to do with the IMAP servers SSL cert not being trusted by the JVM. A possible fix is to download the cert and add it to the JVM's cacerts file. I'm not too sure how but google will be your friend.....
I have imported the certificate from the ssl server into my jvm cacerts. But the error remains. Any ideas?
No idea, but just a suggestion is the imap ssl server listening on the correct port i.e. 993 and what happens if you specify it in the options
<property name="mail.host" value="my.favourite.mailserver.com:993" /> <property name="mail.smtp.host" value="my.favourite.mailserver.com" />