Ok, got it working, stunnel that is. Wasn't too hard (it's unix after all!!).
I went to www.osxzone.com
and found a link to how to set up an SSH server on osx. I needed this to so started from there. The instructions http://www.osxzone.com/stories.php?s.../11/17/7797040
lead you through downloading and installing Apple's hacked source for OpenSSL.
Next I took a copy of the latest stunnel from http://www.stunnel.org
..which seemed to do the right things. Then make and make install.
The stunnel command line I used was...
stunnel -c -d 5000 -r mailserver:993 -B 100 -E /Users/daqman/.gnupg/entropy -f
... which runs stunnel in the foreground so you can keep an eye on care and feeding. The tough part was that it didn't work at first. The ssl layer needs as random number seed. The only way I could get this to work was by installing egd with the osx patch (Instructions on http://www.macsecurity.org/resoures/gpg/
). The -E option loads random seed from the unix socket called entropy.
So now it all works. I start stunnel using the command line from above and point the inbuilt OSX mail IMAP mail client at port 5000 on the local host. By the magic of unix my e-mal is downloaded from the secure IMAP server!!!
Isn't OsX nice. I'm glad I'm also an apple shareholder! ;^)