From: Josh Grebe [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 21, 2005 2:20 PM
> Cc: [email protected]
> Subject: Re: [courier-users] Correct way to do local delivery after
> custom filtering (maildrop without authlib)
> 
> 
> 
> Bowie Bailey wrote:
> > I think what you are missing is the 'xfilter' command for maildrop.
> > 
> > Here is the correct way:
> > 
> > 4. DEFAULTDELIVERY is set to "| /usr/lib/courier/bin/maildrop"
> > 5. /etc/courier/maildroprc has the command:
> >     "xfilter /usr/local/bin/filter"
> > 6. The filter program is designed to accept the entire email on
> > standard input, make any changes, and output the entire changed email
> > to standard output.
> > 7. Maildrop continues normal delivery with the changed email.
> > 
> > This will let you use the normal packaged maildrop, which will get
> > the user information directly from Courier.  You could still pass
> > the $USER variable to the filter program if you want different
> > filtering for different people.  Keep in mind that an xfilter
> > cannot directly change the delivery of the message, it can only
> > modify it.  If you want different delivery options (to a
> > sub-folder, for instance), you would need to have maildrop make
> > those decisions based on headers added by the filter.
> > 
> > Bowie
> 
> Thanks, this helped a lot. I am, however, having a new issue.
> Delivering messages like this seems to ignore the users' .mailfilter
> files in $HOME. As a workaround I tried adding a "include
> $HOME/.mailfilter", but if the file doesn't exist, it defers the
> delivery.
> 
> Pertinant info from my configs:
>   DEFAULTDELIVERY="| /usr/bin/maildrop"
>   MAILDROPDEFAULT=./Maildir
> 
> my maildroprc:
>       import USER
>       import HOME
> 
>       xfilter "/usr/local/bin/filter.php $USER"
> 
>       if ( /^SPAMSPAMSPAMSPAM/ )
>               {
>               to /dev/null
>               }
> 
>       #include $HOME/.mailfilter <- this was my attempt, commented out
>       to Maildir

The last line is what is causing your problem.  Once you have a
delivery instruction, maildrop stops processing the filter files.  If
there is no delivery instruction in maildroprc, then it will continue
on to $HOME/.mailfilter automatically.  If there is no delivery
instruction there, it will deliver to your MAILDROPDEFAULT location.

So just leave off that last line.  Your maildroprc should look like
this:

    import USER
    import HOME
    
    xfilter "/usr/local/bin/filter.php $USER"
    
    if ( /^SPAMSPAMSPAMSPAM/ )
            {
            to /dev/null
            }

One other comment...  Your check is a bit dangerous.  While it is
unlikely that a valid email would have a line like that, you would be
better off adding a normal header line to look for.  Something like
this:

X-MyScan-Results: SPAMSPAMSPAMSPAM

You could also leave the header in there all the time with a "NotSpam"
marker so that you could tell that the mail had been scanned.

Bowie


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to