This is a solution that takes care of the 'invalid' and '@example.com' dilemma on specified user emails post sandbox refresh.
Tweak to taste. You can add additional logic to automate other post-refresh activities as well.
Usage:
- Deploy metadata to Salesforce.

-
Create Internal_User__mdt records in production for each user you wish to sanitize email addresses on (and get rid of 'invalid' suffix) post refresh. Whjen creating these records, populate the User_Id__c field with the user's record Id from Production. Also populate the Email__c field with the user's email.
-
When kicking off a sandbox refresh, populate SandboxRefreshHandler into the Apex Class field.