1 post tagged

customer

Change Customers Email Domains

Sometimes you need to work with a production’s DB dump on a staging or on a dev server. To avoid emails be sent to real customers you should replace their email addresses with safe values. We will use Mailinator service which receives all emails and allows to access them if you know full email address.

Just execute this SQL-query in your DB

UPDATE `customer_entity`
SET `email` = CONCAT(
	SUBSTRING(`email`, 1, locate('@', `email`)),
	'mailinator.com'
);

If you need to left your organization domain email addresses unchanged, just add such condition:

UPDATE `customer_entity`
SET `email` = CONCAT(
	SUBSTRING(`email`, 1, locate('@', `email`)),
	'mailinator.com'
)
WHERE  SUBSTRING(`email`, locate('@', `email`) + 1) != 'my-organization.com';
2015   customer   email