Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- DOMAIN="test.com"
- DOMAINSTORAGE="/var/lib/vpopmail/domains/$DOMAIN"
- SPAMFOLDERS=`mktemp -t spamfolders.XXXXXXXX` || exit 1
- echo "Getting list of spam Maildirs ..."
- find $DOMAINSTORAGE \
- -type d \
- -iname "*spam" \
- -or \
- -iname "*junk" | sed 's@$@/cur/@' > $SPAMFOLDERS
- # cat $SPAMFOLDERS
- inotifywait -m --fromfile $SPAMFOLDERS -e moved_to -e close_write |
- while read path action message; do
- USERNAME=`echo $path | sed 's@.*/\([^/]\+\)/Maildir.*@\1@'`
- echo "User: $USERNAME Message: ${path}${message}"
- spamc --username=$USERNAME@$DOMAIN -l -x -L spam < "$path/$message"
- done
Add Comment
Please, Sign In to add comment