How to prevent IMAP email delete

Have you already tried to copy modules/Emails/metadata/detailviewdefs.php to custom/modules/Emails/metadata/detailviewdefs.php
and editing this last file?

I’d substitute

'DELETE', [ 'customCode' => '<input type=button onclick="window.location.href=\'index.php?module=Emails&action=DeleteFromImap&folder=INBOX.TestInbox&folder=inbound&inbound_email_record={$bean->inbound_email_record}&uid={$bean->uid}&msgno={$bean->msgNo}&record={$bean->id}\';" value="{$MOD.LBL_BUTTON_DELETE_IMAP}">' ], 'FIND_DUPLICATES',

with

           `'DELETE',
            'FIND_DUPLICATES',`