Hello, I need to clean up several mailbox accounts from the server, Is there anyway to delete the mails from a specific user mailbox via command line?. If so, could you please provide me the steps to properly delete the mails without affect the directories created by postfix?. Linux Distro: Centos 6.3 ISPConfig Version: 3.0.4.1 Thanks in advance...
You don't say if you're using courier or dovecot, but if dovecot you would use the doveadm command. You use 'expunge' to delete mail, and 'doveadm expunge' requires a mailbox name, so you must loop through them, eg. Code: doveadm mailbox list -u [email protected] | while read mbox; do echo doveadm expunge -u [email protected] "${mbox}" all; done
Dunno for courier offhand, I suspect just rm the files (and recalculate or clean up maildirsize file if you care about quotas). I'm sure google searches will find some info if noone else replies here.