Juan Miscaro wrote:
> Hi gang,
>
> I would like to have maildrop send tagged spam to a designated user's
> folder (.Polluriel) but its not happening.  I am using Postfix with
> Courier-IMAP on OpenBSD.  This is my maildroprc file:
>
> ------------------
> DEFAULT="/var/spool/virtual_mailboxes/example.com/$1/Maildir"
>
> logfile "$HOME/maildrop.log"
>
> if (/^X-Spam-Status: Yes/)
> {
>   to $DEFAULT/.Polluriel/
> }
> ------------------
>
> Note: Here $HOME=/var/spool/virtual_mailboxes
>
> maildrop doesn't appear to have access to the user variable $1.  Here
> is a line from the maildrop.log:
>
> File: /var/spool/virtual_mailboxes/example.com//Maildir
>
> Postfix's master.cf shows:
>
> maildrop  unix  -       n       n       -       -       pipe
>   flags=Rhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient} -w
> 75
>
>   

you are not passing a $1.  you need to add ${recipient} or ${user} to 
the command above (you probably mean ${user}).

An alternative is to add 'D' to the flags and parse the Delivered-To 
header. assumin you don't accept "nasty" addresses (addresses with 
spaces or other chars that cause parsing issues):

# get the recipient address from the top most Delivered-To header
# Make sure to configure your MTA to supply one.
/^Delivered-To:\s*.+/
RECIPIENT=getaddr ${MATCH}

# split the recipient into user and domain parts
USER=""
DOMAIN=""
if ( ${RECIPIENT} =~ /(.*)@([EMAIL PROTECTED])/ )
{
   USER=${MATCH1}
   DOMAIN=${MATCH2}
}
else
{
  #no domain part
  USER=${RECIPIENT}
}

# extract extension from user-part
# we assume '+' is the delimiter. if you use another char, adjust..
EXTENSION=""
if ( ${USER} =~ /([^\+]+)\+(.*)/ )
{
  #extension found
  USER=${MATCH1}
  EXTENSION=${MATCH2}
}


now you can use ${USER}, ${DOMAIN} (and ${EXTENSION} if desired).

> Is there anything else I can be putting in my maildroprc file?
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Courier-imap mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to