Koozali.org: home of the SME Server

delete all the emails

Offline john56

  • ***
  • 143
  • +0/-0
delete all the emails
« on: June 19, 2017, 04:22:37 PM »
Hi,
is there a way to delete the emails for all users ?
Thanks.

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: delete all the emails
« Reply #1 on: June 19, 2017, 04:31:07 PM »
how many users?
how many emails?
why? :-)

Offline john56

  • ***
  • 143
  • +0/-0
Re: delete all the emails
« Reply #2 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)

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: delete all the emails
« Reply #3 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! ;)



...

Offline john56

  • ***
  • 143
  • +0/-0
Re: delete all the emails
« Reply #4 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 ?

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: delete all the emails
« Reply #5 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.
...

guest22

Re: delete all the emails
« Reply #6 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?

Offline john56

  • ***
  • 143
  • +0/-0
Re: delete all the emails
« Reply #7 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.



Offline john56

  • ***
  • 143
  • +0/-0
Re: delete all the emails
« Reply #8 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 ?

Offline john56

  • ***
  • 143
  • +0/-0
Re: delete all the emails
« Reply #9 on: May 15, 2018, 11:24:13 PM »
up