Direct Admin periodic auto mailbox clearer for one mailbox Blog

This example will delete mail from 2 boxes, on each hour, one each week.

make sure you set USER, DOMAIN.EXT and MAILBOXNAME to their lowercase values, like
myuser, mydomain.com, tempinbox
to clear tempinbox {at} mydomain(.)com from the Direct Admin user named myuser

FILE

/home/USER/mailboxcleaner.sh

#!/bin/bash
find /home/USER/imap/DOMAIN.EXT/MAILBOXNAME/Maildir/new/* -type f -mmin +60 -exec rm {} \; #1 hour
find /home/USER/imap/DOMAIN.EXT/MAILBOXNAME/Maildir/cur/* -type f -mmin +60 -exec rm {} \; #1 hour
find /home/USER/imap/DOMAIN.EXT/MAILBOXNAME/Maildir/new/* -type f -mmin +10080 -exec rm {} \; #1 week
find /home/USER/imap/DOMAIN.EXT/MAILBOXNAME/Maildir/cur/* -type f -mmin +10080 -exec rm {} \; #1 week

CRON

every minute

bash /home/USER/mailboxcleaner.sh >/dev/null 2>&1


Suggestie? Vraag of opmerking? Laat het ons weten!

Plaats hier je bericht

Reacties (0)