Sieve filtering SPAM and redirect

Stephan Bosch stephan at
Mon Sep 12 14:08:40 UTC 2016

Op 12-9-2016 om 15:07 schreef Andre Luiz Paiz:
> Hi every body. I'm having difficulties to setup my filters correctly 
> and I really need some help.
> This is my environment:
> Mail that is received on the system passes through a sieve_before 
> script that checks the message header for SPAM tag and store it into 
> the "Junk" folder. If no spam tag is found, mail goes to inbox.
> My horde webmail is integrated with sieve, so this allow users to 
> create their own scripts to store mail in other folders or forward 
> them to external accounts. And this are the problems I'm having:
> 1 - When users create a forward filter to redirect to external mail, 
> mail that is stored inside the Junk folder are not forwarded;
> 2 - If I insert a "keep" parameter inside the sieve_before script to 
> keep processing the rules, the mail is forwarded, but becomes 
> duplicated and stored inside the inbox or other folders, if the user 
> has more filters.
> 3 - If I move my sieve_before script to sieve_after, the same thing 
> happened, one copy is stored on the user selected folder (inbox or 
> filtered), including mail marked as SPAM.
> My needs are: I need to separate SPAM and HAM e-mail before users 
> intervention (so I need sieve_before). But this SPAM e-mail has to be 
> forwarded if a forward filter is created.
> Is it possible to use a sieve_after script that moves (instead of 
> copy) the user mail marked as SPAM to the Junk folder even if it was 
> stored in a different folder?
> Is that possible?

In the script sequence, it is currently only possible to decide whether 
the next script will execute or not by executing (implicit) keep. It is 
currently not possible to somehow influence which actions subsequent 
scripts can still execute.

Also, once a script is executed, its actions are final. It is not 
possible to undo actions performed by earlier Sieve scripts from within 
Sieve scripts executed later in the script sequence.

At this time, I also don't see how this could be implemented cleanly.

I am fresh out of ideas. :/



More information about the dovecot mailing list