11 Jan
2008
11 Jan
'08
4:13 p.m.
Here is my litte script:
#!/bin/bash
# find all domains for domain in /var/mail/*; do if [ -d $domain ]; then # find all accounts for each domain for user in $domain/*; do if [ -d $user ]; then subscriptionfile=$user/mail/subscriptions
# create subscription file if it does not exist
if [ ! -f $subscriptionfile ]; then
touch $subscriptionfile
fi
grep Spam $user/mail/subscriptions &> /dev/null
# subscribe to folder if user has not been subscribed yet
if [ $? -eq 1 ]; then
echo "Spam" >> $subscriptionfile
fi;
fi
done
fi
done
Maybe this could help someone having the same problem.