Salesforce adds @example.com
or .invalid
to users emails after sandbox refresh (why?). This post script reverts the email addresses.
This project was inspired by Beth Breisnes who asked on Twitter if someone had a Sandbox Post Copy script that would fix users' emails in a sandbox.
I put together a simple proof-of-concept and test class that shows how to mass update all the users' email addresses. However, I have not tested this in a real sandbox. One concern is whether Salesforce will send an "email change verification" to all the users before the change takes effect as is protocol when changing user's emails via Setup. If yes then you likely spammed all your users -- that may or may not be what you were going for.
Daniel Peter shared a thread on Salesforce StackExchange about how some folks try to by-pass their users having to click the verification link themselves, which may or may not be applicable for Sandbox Post Copy (I'm just not sure!).
If email change verification is a problem (I'm not sure yet, I've not tested this in a real sandbox) and you still want to use this technique then you could contact Salesforce Support and request that the verification step be disabled.