Where there is a lot of folders in a mailbox the output may be larger than TEXT will allow (64KiB). Instead use MEDIUMTEXT (16MiB) which should be ample. Additionally check that a sync isn't already running before starting a new one. Fixes: #1011