It is tricky. There are a number of systems which have changes considerably between 4 and 6. Libc, grub and udev come to my mind. Right now 7 is stable but it seems you don't want to jump that far. In 7 Dovecot configuration might be incompatible.
In any way, I would step from 4 to 5 and then from 5 to 6.
Upgrading is straighforward, first upgrade the kernel, then the dist-upgrade.
You will face boot problems in one of these steps, which can be solved with the rescue disk.