I believe your issue is the way you setup your email in Messenger, not sure what app that is. My guess is it's setup as POP3 with leave a copy on the server option selected. If that's the case, mail is downloaded to the app, marked as read and left on the server, it won't be deleted as Cox only deletes unread email after a time period.
Going forward, you have 2 options, use POP3 but don't select leave on server or resetup your account as IMAP. IMAP syncs the mailboxes between the client and server. When you delete something from the client it will also be deleted from the server. Neither option helps with the 23,000 emails you currently have. I don't know of a way to bulk delete, unless someone from Cox can purge your inbox. Finally, no, there isn't a way to set a retention period.