I'm using what ever is in Debian Bookworm, I'm pretty sure. These filters? 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
mick
"mick" == mick crane mick.crane@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@vger.kernel.org" { fileinto "lkml"; } elsif header :contains "X-Mailing-List" "linux-kernel@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.
John Stoffel skrev den 2022-12-13 01:42:
I use something like this and it's pretty good:
require ["fileinto", "envelope"]; require "imap4flags"; require "regex";
can be merged into one line
if header :contains "Sender" "linux-kernel-owner@vger.kernel.org" { fileinto "lkml"; } elsif header :contains "X-Mailing-List" "linux-kernel@vger.kernel.org" { fileinto "lkml"; }
can be merged into one line if "List-Id: Dovecot Mailing List
else { # The rest goes into INBOX # default is "implicit keep", we do it explicitly here keep; }
posting to maillist will get dupes in return since message-id would not change, if any thing should be filtered as dupe delte the sent mail or do nothing :)
On 2022-12-13 00:42, John Stoffel wrote:
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@vger.kernel.org" { fileinto "lkml"; } elsif header :contains "X-Mailing-List" "linux-kernel@vger.kernel.org" { fileinto "lkml"; } else { # The rest goes into INBOX # default is "implicit keep", we do it explicitly here keep; }
I'm sorry, question should have gone to roundcube list as it is roundcube plugin "manage_sieve" am using to make rules. Don't see "elsif" in rule options which is likely what I want.
I'll search for the sieve config file on Debian bullseye.
cheers mick
On 12/18/22 20:59, mick.crane wrote:
On 2022-12-13 00:42, John Stoffel wrote:
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@vger.kernel.org" { fileinto "lkml"; } elsif header :contains "X-Mailing-List" "linux-kernel@vger.kernel.org" { fileinto "lkml"; } else { # The rest goes into INBOX # default is "implicit keep", we do it explicitly here keep; }
I'm sorry, question should have gone to roundcube list as it is roundcube plugin "manage_sieve" am using to make rules. Don't see "elsif" in rule options which is likely what I want.
I'll search for the sieve config file on Debian bullseye.
This is the sieve config in my dovecot:
root@bilbo:/etc/dovecot/conf.d# grep \/var\/vmail * 10-mail.conf:mail_location = maildir:/var/vmail/%d/%u 90-sieve.conf: sieve = file:/var/vmail/sieve/%d/%u/sieve;active=/var/vmail/sieve/%d/%u/.dovecot.sieve 90-sieve.conf: sieve_default = file:/var/vmail/global.sieve
That config results in this:
root@bilbo:/etc/dovecot/conf.d# ls -al /var/vmail/sieve/elyograg.org/elyograg@elyograg.org/ total 44 drwxr-x--- 3 vmail mail 4096 Sep 30 18:11 . drwxr-x--- 5 vmail mail 4096 May 18 2022 .. lrwxrwxrwx 1 vmail mail 21 Jul 23 14:55 .dovecot.sieve -> sieve/phpscript.sieve -rw-r----- 1 vmail mail 7856 Aug 5 2021 .dovecot.sieve.log -rw-r----- 1 vmail vmail 10305 Feb 18 2020 .dovecot.sieve.log.0 -rw-r----- 1 vmail mail 10054 Sep 30 17:46 .dovecot.svbin drwxr-x--- 3 vmail mail 4096 Sep 30 17:45 sieve
I actually have a filter for exactly that purpose:
https://www.dropbox.com/s/5alqcawio2e1vki/roundcube_managesieve_lkml.png?dl=...
I cannot remember how I added list-id to the choices for the header, though. I tried looking it up with google and everything that came up wasn't done on my install. I can't find the customization.
Thanks, Shawn
On 2022-12-19 16:07, Shawn Heisey wrote:
I actually have a filter for exactly that purpose:
https://www.dropbox.com/s/5alqcawio2e1vki/roundcube_managesieve_lkml.png?dl=...
I should experiment further then to see what filters actually do. "stop evaluating rules" in next to last filter seemed to ignore next/last filter.
mick
On 12/19/22 11:08, mick.crane wrote:
On 2022-12-19 16:07, Shawn Heisey wrote:
I actually have a filter for exactly that purpose:
https://www.dropbox.com/s/5alqcawio2e1vki/roundcube_managesieve_lkml.png?dl=...
I should experiment further then to see what filters actually do. "stop evaluating rules" in next to last filter seemed to ignore next/last filter.
The "stop evaluating rules" will normally be the last thing in a filter. I use it in all of my filters so that once a filter matches, that will be the only filter that runs.
You can do some interesting things with multiple filters, but for my purposes, I only ever want one filter to run.
Thanks, Shawn
participants (5)
-
Benny Pedersen
-
John Stoffel
-
mick.crane
-
mick.crane
-
Shawn Heisey