I am looking to remove approximately 150 email alias addresses. Doing this through the Control Panel will be very time consuming and I am wondering if there is a better way to do it?
They are all under a specific subdomain e.g. firstname.lastname@example.org. I want to delete every single alias under sd1.example.com, so that I can eventually remove the domain entirely from MIAB.
I am thinking this might be achievable through the mail.py script but I have no idea where to start!
Would greatly appreciate any help. Thanks!!
You are probably looking at something like connecting to the database file via sqlite directly.
sudo sqlite3 users.sqlite
This puts you into the sqlite prompt. Now try and run this command.
select * from aliases where source like '%sd1.example.com';
If this shows all the records you’d like to delete, you could then alter the SQL command and do:
delete from aliases where source like '%sd1.example.com';
Just be aware that if you execute the above command, it will really delete them all. I’d suggest making a simple backup of your database first so that if you make a mistake you can easily restore.
cp users.sqlite backup-users.sqlite
Maybe that will work for you?
To exit the sqlite prompt once you are done, simply type:
Thank you so much! You just saved me such a long time. Really appreciate your help!