Time and time again another user creates or refreshes a sandbox and I cannot log into it.

I use my credentials from production, but a verification code is sent to the "[email protected]" address, which of course I can never access.

Does anyone know of a way to prevent this from happening? I am sick of having to ask the person creating the sandbox to change my email manually.

3 Answers 3


Have a look at the SandboxPostCopy Interface. It should be possible to have Apex run after the Sandbox is created and then modify the specific User records email address fields.

  • I haven't tried this in practice. If the email addresses are modified to @example before this runs then it should help. Of course, if the emails are modified after then it isn't going to work. Commented Aug 13, 2017 at 23:54
  • 2
    We're actually going to be experimenting with that this week. In theory it should work...
    – sfdcfox
    Commented Aug 14, 2017 at 0:11
  • @sfdcfox Let us know how it works out and if the affected users get notifications of the email address change. Commented Aug 14, 2017 at 0:24
  • Wow. What a ridiculously complex workaround for what should be simple.
    – SFDC Neuf
    Commented Aug 14, 2017 at 21:55
  • 1
    @DanielBallinger my thoughts exactly about DX - it's going to hopefully eliminate a lot more headaches than just this.
    – SFDC Neuf
    Commented Aug 15, 2017 at 20:05

Instead of relying on the email address (which is "munged" during the sandbox copy), you can use your mobile number and self-verify in the sandbox with a text message. To do so, edit your User record in your production org, and put your cell number in the "mobile" field.

Sandboxes created after that point will properly copy your mobile number. When you log into sandboxes for the first time, you will be given the option to self-verify by receiving a text message to your phone number.


If your OK with using an IDE and your profile settings allow it, you can always download the file "Security.settings", part of the Security metadata type and add your IP address in as a trusted IP. You can then login via the browser without the verification code and change your email address to the correct one.

An example of an ExactTarget range is below - just copy/paste and add your own ip in for start/end ranges.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .