#!/bin/sh # AUTOMATICALLY CREATE virtual DIRECTORY # # assumes NAMESPACE_1 is your normal mail, NAMESPACE_2 # is virtual. ${NAMESPACE_2} contains the directory # we need to create but in an inconvenient format, so # here we assume it's $HOME/Maildir/virtual export VIRTUAL=$HOME/virtual-mail if [ ! -d "$VIRTUAL" ]; then # su to get right ownership su $USER -c 'mkdir -m 700 -p "$VIRTUAL"' fi # AUTOMATICALLY VIRTUALIZE INBOX # # If the user creates a virtual/INBOX/dovecot-virtual, # switch the inbox to the virtual namespace. if [ -s "${VIRTUAL}/INBOX/dovecot-virtual" ]; then unset NAMESPACE_1_INBOX export NAMESPACE_5_INBOX=1 fi exec /usr/lib/dovecot/imap "$@"