If losing literally everything mail related isn’t issue then running this in SQL should help.
-
Remove Mail app using Web UI
-
DELETE FROM oc_migrations WHERE app=‘mail’;
DELETE FROM oc_preferences WHERE appid=‘mail’;
DROP TABLE IF EXISTS oc_mail_accounts,oc_mail_aliases,oc_mail_attachments,oc_mail_classifiers,oc_mail_coll_addresses,oc_mail_mailboxes,oc_mail_messages,oc_mail_messages,oc_mail_recipients,oc_mail_trusted_senders; -
Install Mail app again