I've got about 80 records in my database for contacts who all work for an important organisation that we liaise with. They've just changed their email domain, but all of the front part of their email addresses don't change, e.g. [email protected] is now [email protected].

What's the simplest way to update all 80 addresses in CiviCRM?

3 Answers 3


Run a sql query on mysql table

UPDATE civicrm_email
SET email = REPLACE(email, '@old-domain.org', '@new-domain.org')
WHERE email LIKE '%@old-domain.org';
  • That's really helpful, as I struggle with MySQL syntax. This sort of functionality would be great to have in the UI.
    – Graham
    Commented Jun 8, 2021 at 12:12

You can do a contact search for contacts with that email adress ending, and then bulk update with profile. And then manually copy/paste the correct ending on all 80 emails, before saving.

It takes more time than the SQL, but on the other hand you do it in the UI and have full control of the result without having to do extensive testing (which you should do when using SQL-commands pasted from online)

  • This is in fact what I ended up doing. With not many contacts involved it was workable. Clunky, but workable.
    – Graham
    Commented Jun 10, 2021 at 8:11

You could export the above 80 with their Contact ID, then do a find/replace in a s/sheet, then reimport them using 'update' and match on Contact ID

(hmm having written this i now wonder if it would overwrite the existing email address or just add another one. will leave this here for now but delete if someone points out i am wrong)

As Alan says below "Using civicrm.org/extensions/api-csv-import-gui [you can work] directly with the email entities"

  • This would also require same amount of testing as the SQL solution
    – Flying
    Commented Jun 8, 2021 at 20:06
  • I think for a non-technical user this has a lower threshold for usage than the SQL hence putting it up as an option.
    – petednz - fuzion
    Commented Jun 9, 2021 at 0:34
  • 1
    I like this one the best! Using civicrm.org/extensions/api-csv-import-gui and working directly with the email entities would make this process a bit more bulletproof.
    – Alan Dixon
    Commented Jun 9, 2021 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.