Magento code snippets: mix up customer emails

Sometimes when you working on Magento project you need to have some live data on your local machine to test functionality. So, you need to import live DB. But you don’t want to accidentally send any emails to existing live customers of course.

Here is the mysql query that will mixup a customer emails:

or if you want to preserve customer emails for whatever reason:

Choose one you like. The only difference is a produced emails. First variant produce customer_12345@localhost.dev alike emails. The second one will produce local_real@email.com alike emails to preserve email original values for further work on them.

Please NEVER perform this query on production!

Rating:

Rate this post

Comments (4)

  1. Why not to use this query? :
    update customer_entity set email = concat(email, ‘.dev’);

What do you think?

Required fields are marked *


*