Bulk update user email addresses

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
chamberlain
Posts: 2
Joined: 17 Feb 2009, 12:44

Bulk update user email addresses

Post by chamberlain »

Hi All,

I have about 400 users in my Mantis installation. A lot of these users have the same email domain (surname@company.com). Our email domain has changed (firstname.surname@newcompanyname.com) and I don't like the idea of manually updating all those email addresses...

Is there a smart way to bulk update the email addresses of these users? I am guessing I will have to do this on the DB level using a SQL script. Note, this does not apply to all users in the system, but the vast majority.

Any suggestions or experiences from people who have been through this before are much appreciated!

Regards,
Steve
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Bulk update user email addresses

Post by atrol »

Use at your own risk

Code: Select all

update mantis_user_table set email = replace (email, '@company.com', '@newcompany.com')
first try one user to test

Code: Select all

update mantis_user_table set email = replace (email, '@company.com', '@newcompany.com') where username = 'testname'
Please use Search before posting and read the Manual
Post Reply