File subscribeIMAP.sh of Package maildrop
#!/bin/sh
#
# $Id: subscribeIMAP.sh,v 1.2 2004/02/18 15:54:44 matt Exp $
#
# This subscribes the folder passed as $1 to courier imap
# so that IMAP clients (including some webmail programs like
# Mailman and Squirrelmail) will recognize the extra folder.
#
# Matt Simerson - 12 June 2003
LIST="$2/Maildir/courierimapsubscribed"
if [ -f "$LIST" ]; then
# if the file exists, check it for the new folder
TEST=`cat "$LIST" | grep "INBOX.$1"`
# if it is not there, add it
if [ "$TEST" == "" ]; then
echo "INBOX.$1" >> $LIST
fi
else
# the file does not exist so we define the full list
# and then create the file.
FULL="INBOX\nINBOX.Enviados\nINBOX.Lixeira\nINBOX.Rascunhos\nINBOX.$1"
echo -e $FULL > $LIST
/bin/chown vpopmail:vchkpw $LIST
/bin/chmod 644 $LIST
fi