Deleting Mails in Trash after x days

I am using Nextcloud Mail for all my accounts, but realized that it is not a simple task to delete mails in the trash which are older then x days.
Is there any option, like with files, to only keep the last 300 days of mails and delete the rest?
I have around 10000 mails in the deleted folder, even though I wanted to go to the oldest ones to delete them - this is not working with Nextcloud Mail as expected (or just takes forever :smiley: ).

Thanks

I think the Mail App is (only) a IMAP client for mail servers. I think you must set it at your mail provider if possible.