Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: john56 on June 19, 2017, 04:22:37 PM

Title: delete all the emails
Post by: john56 on June 19, 2017, 04:22:37 PM
Hi,
is there a way to delete the emails for all users ?
Thanks.
Title: Re: delete all the emails
Post by: Stefano on June 19, 2017, 04:31:07 PM
how many users?
how many emails?
why? :-)
Title: Re: delete all the emails
Post by: john56 on June 19, 2017, 04:34:47 PM
for 150 teachers users (i've delete the 550 others school users so that's ok).
of course , I will keep their account and home. But need to clean their emails (not used anymore)
Title: Re: delete all the emails
Post by: Jáder on June 19, 2017, 07:43:38 PM
I think you could use something like:
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -rf $u/Maildir/*
done; \
popd

NOT TESTED!
If you´re not sure, add an "echo " before the rm -rf line to see the result, copy/paste one sample line and try it! ;)



Title: Re: delete all the emails
Post by: john56 on June 24, 2017, 11:06:27 AM
That seems ok to delete with :
Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -rf $u/Maildir/*
done; \
popd

pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -rf $u/Maildir/*.*
done; \
popd

pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -f $u/welcome.msg
done; \
popd

but not for the send messages ... where are they to delete them too ?
Title: Re: delete all the emails
Post by: Jáder on June 24, 2017, 11:29:27 PM
Hi

This command should be EVEN MORE DESTRUCTIVE:

Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -rf $u/Maildir
done; \
popd

I think his will destroy all maildir folders for all users but admin.
Maybe you need a signal-event email-update or  something else to recreate it.
Not sure if daemons will reconstruct them if not there or if they'll fail to delivery e-mails.
Title: Re: delete all the emails
Post by: guest22 on June 25, 2017, 06:59:04 AM
I will keep their account and home. But need to clean their emails (not used anymore)

Some bright advisor said to go for 365 or gma*l email solutions?
Title: Re: delete all the emails
Post by: john56 on June 25, 2017, 09:15:33 AM
Hi !

Code: [Select]
pushd /home/e-smith/files/users/; \
for u in `ls | grep -v admin`; \
do \
  rm -rf $u/Maildir
done; \
popd

It works fine with that command (strange no ?)


RequestedDeletion, yes ... school is business too :)

My students and teachers don't really like horde and that mail system ... i don't know why...
Me, i like it because of ldap rules.


Title: Re: delete all the emails
Post by: john56 on June 26, 2017, 09:29:30 AM
So, in fact, i have another issue now with cron command
"perl /etc/e-smith/events/actions/purge-junkmail-folders"

Couldn't chdir to junkmail folder of user angotr: Aucun fichier ou dossier de ce type

because there is no more folder Maildir etc ...

How can generate them again ?
Title: Re: delete all the emails
Post by: john56 on May 15, 2018, 11:24:13 PM
up