HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   auto delete spam/junk webmail folder (http://www.howtoforge.com/forums/showthread.php?t=49189)

Turbanator 1st October 2010 18:51

auto delete spam/junk webmail folder
 
Does anybody already have a script that will auto go through each users webmail folders (roundcube, not that it matters) and delete old mail from spcified folders (spam and junk)? I'm using ISPC3 but that also shouldn't matter.

The easiest way is to delete all automatically but I'd rather have it look for email older than X days.

falko 2nd October 2010 13:55

You can do this with the find command. There's a script on http://www.howtoforge.com/back_up_my..._interruptions that should give you the idea how to do this.

Turbanator 4th October 2010 20:52

I found this on the net, so I'll try to understand what it does and tweak it.

Code:

...
So i found a little script on the net, and modified it a bit for use with ISPConfig.
It will remove Messages older than 14 days from users .Junk folder.
I run it daily via cron.

cat /etc/cron.daily/purge.junk

#!/bin/sh

HOURS=$((2 * 24 * 7))

for domain in /var/www/*
do
if [ -d "$domain"/user ]
then
cd $domain/user
for user in *
do
if [ -d "$user/Maildir/.Junk" ]
then
tmpwatch -m $HOURS $user/Maildir/.Junk/{cur,new}
fi
done
cd /var/www
fi
done


Edit(11 Jan 2008):

You might want to add :
/etc/init.d/dovecot restart
to the script, to make dovecot rebuild message indexes.


Turbanator 5th October 2010 02:00

For anybody else who is blind like me....there is a HOW TO on this already done for ISPC2 and ISPC3.

http://www.howtoforge.com/automatic-...eaper-tmpwatch


All times are GMT +2. The time now is 17:47.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.