When using the Saleseforce UI, it is possible to change a user's email and send them a password at the same time by changing the email and clicking 'Generate new password and notify user immediately' checkbox before saving. This avoids sending 2 emails (one for email change and one for password reset).
Is there a similar way to do this using Apex code that could be run in a SandboxPostCopy class?
I know it is possible to reset a user's password using
System.resetPassword(userId, true);. I'm not sure how to go about doing the email update at the same time to avoid sending the password reset to the wrong email.