After that you will need to update the information in the database about the domain used. Run the following commands:
docker exec -it onlyoffice-mysql-server mysql -pmy-secret-pw --silent -e "use onlyoffice; update mail_server_server SET mx_record = '{NEW-MX-DOMAIN}';"
docker exec -it onlyoffice-mysql-server mysql -pmy-secret-pw --silent -e "use onlyoffice; update mail_server_server ms inner join mail_mailbox_server s on ms.smtp_settings_id = s.id or ms.imap_settings_id = s.id SET s.hostname = '{NEW-MX-DOMAIN}';"
docker exec -it onlyoffice-community-server mysql -pmy-secret-pw --silent -e "use onlyoffice; update mail_server_dns set mx='{NEW-MX-DOMAIN}' where mx='{OLD-MX-DOMAIN}';"
Where {NEW-MX-DOMAIN}
is again the new address used for ONLYOFFICE Mail and {OLD-MX-DOMAIN}
is the old address.