6 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] Automatically creatin...
FromSent OnAttachments
seat...@scygro.ath.cxMar 17, 2005 10:15 pm 
RobinMar 18, 2005 1:45 am 
seat...@scygro.ath.cxMar 18, 2005 1:55 am 
RobinMar 18, 2005 3:03 am 
Sam VarshavchikMar 18, 2005 4:16 am 
Joaquim LaureanoMar 18, 2005 5:45 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] Automatically creating home directories (not just maildir)Actions...
From:Joaquim Laureano (laur@lusostar.com)
Date:Mar 18, 2005 5:45:38 pm
List:net.sourceforge.lists.courier-maildrop

Below is my current maildroprc used on a server where mail accounts data is stored in MySQL - postfix, maildrop, courier-imap, squirrelmail.

I simply create an account entry in the database without being concerned with setting up any directory for that account. When the first email for the account arrives, maildrop creates the account directories and quota file. The same goes for assumedspam and spam directories.

It is working fine for me, if you find it useful, use at your own risk.

VHOME="/path to the vhosts dir/vhosts" ACCOUNT=`echo "$LOGNAME" | cut -d@ -f1` USERDOMAIN=`echo "$LOGNAME" | cut -d@ -f2` VMAIL_LOGFILE="/path to the vhosts dir/maildrop-log.txt"

`test -d "$VHOME/$USERDOMAIN/$ACCOUNT"` if( $RETURNCODE == 1 ) { MESSAGE_DATE = `date` `echo CREATION DATE: "$MESSAGE_DATE" >> $VMAIL_LOGFILE` `echo EMAIL DIRECTORY: "$VHOME/$USERDOMAIN/$ACCOUNT" >> $VMAIL_LOGFILE` `echo USER EMAIL LOGIN: "$LOGNAME" >> $VMAIL_LOGFILE` `echo USER QUOTA SIZE: "$MAILDIRQUOTA" >> $VMAIL_LOGFILE` `echo " " >> $VMAIL_LOGFILE`

`test -d "$VHOME/$USERDOMAIN"` if( $RETURNCODE == 1 ) { `echo CREATING DIRECTORY: "$VHOME/$USERDOMAIN" >> $VMAIL_LOGFILE` `mkdir -p "$VHOME/$USERDOMAIN"` `echo " " >> $VMAIL_LOGFILE` }

`/usr/local/courier/bin/maildirmake "$VHOME/$USERDOMAIN/$ACCOUNT"` `/usr/local/courier/bin/maildirmake -f Sent "$VHOME/$USERDOMAIN/$ACCOUNT"` `echo INBOX.Sent >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` `/usr/local/courier/bin/maildirmake -f Trash "$VHOME/$USERDOMAIN/$ACCOUNT"` `echo INBOX.Trash >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` `/usr/local/courier/bin/maildirmake -q "$MAILDIRQUOTA"S "$VHOME/$USERDOMAIN/$ACCOUNT"` `touch $VHOME/$USERDOMAIN/$ACCOUNT/courierimapuiddb` `mkdir -p "$VHOME/$USERDOMAIN/$ACCOUNT/courierimapkeywords"` }

if ( $SIZE < 26144 ) { exception { #xfilter "/usr/bin/spamassassin" xfilter "/usr/bin/spamc" } }

if (/^X-Spam-Flag: *NO/) { exception { `echo X-Spam-Flag=NO >> /tmp/maildrop` }

exception { to "$VHOME/$USERDOMAIN/$ACCOUNT/Maildir" cc "|/usr/bin/sa-learn --single --ham" } } else { exception { `echo X-Spam-Level=YES >> /tmp/maildrop` }

if ( /^X-Spam-Level: *-----.*$/ ) { exception { `echo X-Spam-Level=SPAM >> /tmp/maildrop` }

if( test -d $VHOME/$USERDOMAIN/$ACCOUNT/.Spam ) { `maildirmake -f Spam $VHOME/$USERDOMAIN/$ACCOUNT` `echo INBOX.Spam >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` }

exception { to "$VHOME/$USERDOMAIN/$ACCOUNT/.Spam" } cc "|/usr/bin/sa-learn --single --spam" }

if ( /^X-Spam-Level: *-.*$/ ) { `test -d $VHOME/$USERDOMAIN/$ACCOUNT/.AssumedSpam` if( $RETURNCODE == 1 ) { `maildirmake -f AssumedSpam $VHOME/$USERDOMAIN/$ACCOUNT` `echo INBOX.AssumedSpam >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` }

exception { to "$VHOME/$USERDOMAIN/$ACCOUNT/.AssumedSpam" } } }

On Fri, 2005-03-18 at 08:15 +0200, seat@scygro.ath.cx wrote:

Hi there,

I need to have maildrop create home directories on the fly when delivering first message. I have managed getting the maildir's created by reading up a bit and adding this:

`until test -d $HOME/.maildir; do /usr/bin/maildirmake $HOME/.maildir; done`

to /etc/maildroprc

However, I need $HOME created as well. I tried, but maildrop doesn't even get to this point if $HOME doesn't exist.

My current setup is as follows: /home/vmail/domain.tld/user/.maildir

Where 'user' would be the home directory, and .maildir the mail directory. I do need the home directory for mailfilter files to sit in.

How do I *make* maildrop create the home directory (and possibly the domain directory too) on first delivery? Is it possible? (Outside of script/croning etc, and so forth)?

Thank You