auto delete spam/junk webmail folder

Discussion in 'Programming/Scripts' started by Turbanator, Oct 1, 2010.

  1. Turbanator

    Turbanator Member HowtoForge Supporter

    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.
  2. falko

    falko Super Moderator ISPConfig Developer

  3. Turbanator

    Turbanator Member HowtoForge Supporter

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

    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
    HOURS=$((2 * 24 * 7))
    for domain in /var/www/*
    if [ -d "$domain"/user ]
    cd $domain/user
    for user in *
    if [ -d "$user/Maildir/.Junk" ]
    tmpwatch -m $HOURS $user/Maildir/.Junk/{cur,new}
    cd /var/www
    Edit(11 Jan 2008):
    You might want to add :
    /etc/init.d/dovecot restart
    to the script, to make dovecot rebuild message indexes.
  4. Turbanator

    Turbanator Member HowtoForge Supporter

: delete, webmail

Share This Page