Bulk delete email accounts

alipour66m

Verified User
Joined
Feb 22, 2013
Messages
65
I have 1000 unused email accounts in directadmin
I have put them in a text file (line by line)
How can i delete them from root access?
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,021
There would be 2 ways to go about it..
1) Create an API script to call DA for each E-Mail, and delete the accounts, one by one, in a loop.

2) If you know you've not setup anything special with the accounts (eg: not used roundcube) and only did basic imap/pop access, then you might have more luck with a shell script to edit:
/etc/virtual/domain.com/passwd
/etc/virtual/domain.com/quota

for each account, and delete the values from there (script would need to parse out the domain)
Also delete this path:
/home/username/imap/domain.com/user

If you did use roundcube or squirrelmail, there might be left-overs in the database... they won't hurt anything, but will take up space.
The left-over data cannot be accessed unless the given account is re-created (contacts lists, webmail settings, etc...)

John
 
Top