Came across this weird bug when upgrading a system through Weezy -> Jessie -> Stretch today. A server was running dovecot with imaps. After the upgrade, it was no longer responding on port 993.
After some digging around, i found out that the issue was located in
ssl = no
You can go ahead and change that setting to
ssl = required and have another look at the various settings in the file.