mail filters

John Stoffel john at stoffel.org
Tue Dec 13 00:42:55 UTC 2022


>>>>> "mick" == mick crane <mick.crane at gmail.com> writes:

> I'm using what ever is in Debian Bookworm, I'm pretty sure.
> These filters?

sieve of some sort.

> I collect from different email addresses like gmail and that.  If
> filter for the "Sent to" email address, move to this directory If
> "From" contains "blah", move to this other directory.  If something
> is Sent to and also From contains "blah" then I get 2 copies of the
> message in both filter directories.  How can I fix this?  regards

By posting an example of the non-working filter code?  Otherwise how
do we know what's giong wrong?

Maybe you're filtering the wrong way?  

I use something like this and it's pretty good:

   require ["fileinto", "envelope"];
   require "imap4flags";
   require "regex";

   if header :contains "Sender" "linux-kernel-owner at vger.kernel.org" {
     fileinto "lkml";
   }
   elsif header :contains "X-Mailing-List" "linux-kernel at vger.kernel.org"
   {
     fileinto "lkml";
   }
   else {
     # The rest goes into INBOX
     # default is "implicit keep", we do it explicitly here
     keep;
   }


There's an implicit exit in each block as I recall and as my notes in
there show... I've got a whole bunch of other matches.  

Now where *my* rules fail at times is handling duplicates which were
went to a mailing list AND sent to me directly.  I need to fix it, but
haven't bothered to spend the time yet.




More information about the dovecot mailing list