I know of one problem with my setup which is self-hosted.
IMAP auth is configured to acccept AUTH=PLAIN, but only after STARTTLS.
AFAIK the account setup does not try AUTH PLAIN, it defaults to AUTH LOGIN.
Solution for me was to edit/patch
/usr/share/accounts/ui/email.qml
and add the line
account.setConfigurationValue(defaultServiceName, "imap4/authentication", '2')
somewhere around line 82.
For me it was only necessary during initial setup, later it works fine. YMMV.