[Dovecot] Automatically subscribe to folder?

Christian Flothmann christian.flothmann at xabbuh.de
Fri Jan 11 16:13:01 EET 2008


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.



More information about the dovecot mailing list