Changing primary domain, certificate error on IMAP/SMTP

I’m trying to change the primary domain from to

The only problem I have is that all the users that have configured their mail client with the old domain, receive a certificate error because the CN doesn’t match (even if MIAB has certificates for both the domains, the webmail on the old domain works)

Can this be solved in MIAB? Or what is the best way to do this? A reverse proxy that listen on 993/587 on the olddomain and forward it to the new one? Has anyone ever done this and can give me some advice?

Solved, I had to delete the old certificates from /home/user-data/ssl, so that I could generate a new certificate that includes all the hostnames

I’m not sure if it’s true, but anyone else having this issue, I believe you can also put both certificates for both domains in the same file, and either one of those will be valid for the domain.