<<< Date Index >>>     <<< Thread Index >>>

Re: maildrop mailfilter syntax



On 2006-11-07 @ 16:32:19 (week 45) Russell L. Harris wrote:

> I am switching from Gnus to Mutt, and am using maildrop to provide the 
> sorting which I previously was doing with Gnus.  The processing chain
> 
>    pop3.isp.com -> getmail4 -> maildrop -> [ maildir structures ] -> mutt
> 
> is handling incoming mail, but maildrop is delivering all messages to 
> the default maildir "~/mail/nondescript"; so it appears that there is an 
> error in the syntax of "~/.mailfilter".  At first, I suspected that the 
> characters '[' and ']' were causing a problem, but even mail which 
> SpamAssassin (running at my ISP) flags with the word "SPAM" in the 
> subject line is being delivered to "~/mail/nondescript".
> 
> Here are my mailfilter instructions:
> 
>    DEFAULT=$HOME/mail/nondescript
> 
>    # spam is flagged by SpamAssassin at the ISP
> 
>    if ( /^"Subject:".*"SPAM"/ )
>    to spam
> 
>    if ( /^("To"||"Cc")":".*"debian-user"/ )
>    to computer/debian
> 
>    if ( /^("To"||"Cc")":".*"mutt-users"/ )
>    to computer/mutt
> 
>    if ( /^"Subject:".*"[alsa-user]"/ )
>    to computer/alsa
> 
>    to $DEFAULT

You have a syntax error in your filter definitions (if you use maildrop
as a MDA your mail log should contain warnings indicating a failure, not
sure about getmail4 though, don't know that one).

Use curly brackets to enclose your filter blocks. Here's an example from
my ~/.mailfilter (with a mailfolder containing square brackets in its
name to demonstrate the syntax for that as well):

#Filter debian-user list messages
if (/^X-Loop: debian-user@lists\.debian\.org$/)
{
  to "$MAIL/.Debian.[debian-user]/"
}

Read the paragraph "IF - CONDITIONAL EXECUTION" in the mailfilter
manpage for more info. Also read man maildropex for more examples to get
you going.

HTH

Grx HdV