I tried with the option --useuid and without --useheader (if I understood correctly, this option is obsolete if one uses the --useuid option) but I've go a tons of error messages like this one:
Use of uninitialized value $h1_flags in substitution (s///) at /usr/local64.hg/app/imapsync/current/bin/imapsync line 2374.
Use of uninitialized value $flags in split at /usr/local64.hg/app/imapsync/current/bin/imapsync line 2256.
Use of uninitialized value $_[0] in sort at /usr/local64.hg/app/imapsync/current/bin/imapsync line 1300.
Use of uninitialized value $_[0] in sort at /usr/local64.hg/app/imapsync/current/bin/imapsync line 1300.
- msg INBOX/333 couldn't append (Subject:[]) to folder INBOX: Error sending '523 APPEND INBOX () {0}': 523 BAD Command Argument Error. 12
and even after 14227 seconds the sync wasn't finish.