[WBEL-users] WBEL-List and maildrop

christian.huegel@fedoraforum.de christian.huegel@fedoraforum.de
Thu, 18 Nov 2004 19:16:09 +0100


Kirby C. Bohling wrote:
> On Thu, Nov 18, 2004 at 10:55:33AM +0100, christian.huegel@fedoraforum.de wrote:
> 
>>Hi everybody,
>>
>>i have a problem filtering mails from the WBEL-List. The other filters in
>>my maildroprc files are ok and mails are delivered in the right folder.
>>IŽve tried different constelations but none worked. This is the part for
>>the WBEL-List in my maildroprc-file:
>>
>>
>>if (/^List-Id:.*whitebox-users*/)
>>{
>>    exception {
>>        to $HOME/.Maillist.WBEL-User/
>>  }
>>}
> 
> 
> 
> ^List-Id: WBEL Users \<whitebox-users\.beau\.org\>
> 
> This is roughly the regular expression I use (I actually use one
> regular expression to pull the line that starts with "List-Id:" in
> procmail and one in python to pick a particular folder).  I'm not
> sure this syntax is exactly what you'd need.
> 
> Your Regular expression probably needs to be like this:
> 
> if (/^List-Id:.*whitebox-users.*/)
> 
> Notice the '.' included after the 's' in "users".  I've never used
> maildrop, but if it has to match the entire line that's your
> problem.  If it's only a partial line match, then your expression
> should have worked unless the two '-', or the ':' needs to be
> escaped.
> 
> I've always thought Maildrop looked better then procmail if only
> because it looks like a real programming language which makes it
> more intuitive to me.
> 
> The last thing that comes to mind, is that some MDA won't create a
> new folder (tmail for instance I believe won't).  So my problem is
> that everything is correct, but tmail refuses to create the folder.
> I create the folder and my procmail scripts start working.
> 
Hi Kirby and thanks for your reply,


well, youŽre right, maildrop wonŽt create maildirs.
I use Postfixadmin [1] for creating accounts and maildirs; There is also 
a good HOWTO [2] about ist.
I just added in  my create-mailbox.php this line:
system("/usr/bin/sudo /usr/sbin/maildircreate.sh $fDomain 
".$_POST['fUsername']);

The shell-script maildircreate looks like this:

#!/bin/bash
# Some variables. Change to your need
CREATEDIR=/usr/local/courier/bin/maildirmake
VMAIL=/home/vmail

##########END CHANGE SECTION###################

cd $VMAIL
MATCH=`ls |grep "$1"`
   if [ "$MATCH" != "$1" ]
    then
       mkdir $VMAIL/"$1"
       chmod 700 vmail:vmail "$1"
       chown -R vmail:vmail "$1"
       cd "$1"
       `$CREATEDIR $VMAIL/"$1"/"$2"`
       chown -R vmail:vmail $VMAIL/$1/$2
       chmod -R 700 $VMAIL/$1/$2
    else
      cd $VMAIL/"$1"
      $CREATEDIR "$2"
      chown -R vmail:vmail $VMAIL/"$1"/"$2"
      chmod -R 700 $VMAIL/"$1"/"$2"
  fi

So everytime i add a new mailaccount the maildir is created on-the-fly.

I guess, iŽll give it another try with maidrop-filtering.

[1] http://high5.net/postfixadmin/
[2] http://high5.net/howto/#postfixadmin

Christian