Find your content:

Search form

You are here

Identify or auto-disable Email notifications non-user Email Addresses in Sandbox

 
Share

I have a number of Email Notifications that are sent to non-users. Sometimes they are contact emails and others it's straight up email address like "MyPoor_NonSalesforce_Coworker@Mywork.com"

When I refresh a sandbox, User Emails change to @MyWork.com.SandboxName It doesn't look like Contact Email Addresses or any other non-user addresses keep their name.

So if I accidentally do something to a record that triggers and email or a trigger I could be suddenly emailing Sandbox data to a contact or to that other email address without intended to.

Anyone got suggestions on how to handle this? I used to just keep a manual list of my Email notifications and disable them. But as we grow this is taking more and more time. Plus, I'm not the only Admin so I may have to manually review (yuck).

Thoughts?


Attribution to: Salesforce Wizard

Possible Suggestion/Solution #1

Easiest option might be to just update all the contacts to have fake addresses using data loader, or if the number of contacts would be within governor limits you could run a small script in the execute anonymous section of the developer console:

list<Contact> toUpdate = new list<Contact>();

for(Contact c : [Select Id, Email from Contact])
{
  c.Email += '.fake';
  toUpdate.add(c);

  if(toUpdate.size() == 200)
  {
    update toUpdate;
    toUpdate.clear();
  }
}

if(toUpdate.size() > 0)
{
  update toUpdate;
}

Obivously you could add some more smarts to this if need be, for instance limiting to 20,000 records and only grabbing contacts where the email doens't contain .fake and run it a few times. If you're cutting sandboxes on a regular basis then maybe you could adapt this code to be a class implementing batchable and throw together a quick page to execute the batch when needed, deploy that to your production org and you'll always have it to hand right after creating/refreshing a sandbox!


Attribution to: Matt Lacey

Possible Suggestion/Solution #2

Could you change the User Permissions for your active user to prevent sending emails?

In the past I've disabled the Send Outbound Messages to similar effect. It might just be a matter of finding the correct permission. Maybe the General User Permissions "Send Email" and/or "Mass Email"?


Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/248

My Block Status

My Block Content