Setting up imap account in Apple Mail: discards username and tries to login with email address instead
I have a weird issue with Apple Mail on Macbook Air, Ventura.
NB: This is quite technical and includes snippets of server log files. Be warned, but please keep on reading if you want. :)
Technical background: I have a mail server setup with SMTP and IMAP (Postfix + Dovecot). IMAP login is with normal user account and unix password on the server (/etc/password and /etc/shadow). Apple Mail on iPad has no problems connecting to the IMAP server, but I can't get it to work with Apple Mail on my wifes Macbook Air (MacOS Ventura). Looking at the server log I can see that Apple Mail first makes a successful login with the account name I supply, but immediately closes that connection and then tries repeatedly to login with first the email address and then the email address with the domain part stripped off.
Why oh why does Apple Mail throw away the given account name after having made one successful login with that name? What can I do (if anything) to make Apple Mail use the supplied account name which works?
Some log lines from the mail server
First a successful login:
Jul 25 18:23:08 srv-1 dovecot: imap-login: Login: user=<account name>, method=PLAIN, rip=192.168.1.1, lip=192.168.1.33, mpid=6465, TLS, session=<Nd6k0lMBwfXAqAEB>
Then Apple Mail throws away <account name> and tries with <email-name@domain.se>:
Jul 25 18:25:51 srv-1 dovecot: auth-worker(6475): conn unix:auth-worker (pid=6473,uid=118): auth-worker<1>: pam(email-name@domain.se,192.168.1.1,<gG1C3FMB1PXAqAEB>): pam_authenticate() failed: Authentication failure (Password mismatch?)
After several failures Apple Mail then strips the domain part:
Jul 25 18:26:21 srv-1 dovecot: auth-worker(6475): conn unix:auth-worker (pid=6473,uid=118): auth-worker<7>: pam(email-name,192.168.1.1,<gG1C3FMB1PXAqAEB>): pam_authenticate() failed: Authentication failure (Password mismatch?)
I really hope some wizard out there can point me in the right direction for solving this issue.
MacBook Air (M1, 2020)