Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; }
rule:[redir]
if true { redirect "jorge@decimal.pt"; }
Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; }
rule:[redir]
if true { redirect "jorge@decimal.pt"; }
Try "imapsieve_expunge_discarded = yes" in your config. It was necessary in my case. BR: Dw.
dr Tóth Attila, Radiológus, 06-20-825-8057 Attila Toth MD, Radiologist, +36-20-825-8057
On 2026.09.02 14:05, Jorge Bastos via dovecot wrote:
Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; }
rule:[redir]
if true { redirect "jorge@decimal.pt"; }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Hello,
You can try to add "stop;" after "discard;", so that rule processing stops after the discard and doesn't trickle down to the other rule.
On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote:
Hi guys, Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected. Any idea what is wrong here? # rule:[blocks] if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; } # rule:[redir] if true { redirect "jorge@decimal.pt"; }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- Anto'nio Henrique A. Proenca de Oliveira "Although we can never go back, like an old sweet song with a strong refrain, memories remain" - (Someone)
Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html $Id: .signature,v 1.5 2008/03/13 11:22:00 tat Exp tat $
Op 2-9-2026 om 16:00 schreef Antonio Oliveira via dovecot:
Hello,
You can try to add "stop;" after "discard;", so that rule processing stops after the discard and doesn't trickle down to the other rule.
Yes, this will help. Why? The discard action command only cancels the implicit keep; nothing else. It means that if and only if no other explicit action delivers or preserves (keeps!) the message somehow, it is discarded. So, if subsequently redirect is triggered, the message is redirected, thereby making the discard action ineffective. Stopping the script right after discard will make sure no other actions can be triggered, thereby making sure the message is discarded (provided no earlier actions already triggered some sort of delivery either). Without discard or any other action command that cancels the implicit keep (such as redirect, fileinto, and ... keep), the default action is to "keep" the message, e.g. file it to INBOX.
Regards,
Stephan.
On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote:
Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
# rule:[blocks] if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; } # rule:[redir] if true { redirect "jorge@decimal.pt"; }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
I'm using a filter that moves the mail to another directory. The original message disappeared only from the initial location if imapsieve_expunge_discarded = yes was set. A duplicate remained otherwise. I suggest to take a look at on this configuration option depending on the purpose of the filter.
On 2026.09.06 02:30, Stephan Bosch via dovecot wrote:
Op 2-9-2026 om 16:00 schreef Antonio Oliveira via dovecot:
Hello,
You can try to add "stop;" after "discard;", so that rule processing stops after the discard and doesn't trickle down to the other rule.
Yes, this will help. Why? The discard action command only cancels the implicit keep; nothing else. It means that if and only if no other explicit action delivers or preserves (keeps!) the message somehow, it is discarded. So, if subsequently redirect is triggered, the message is redirected, thereby making the discard action ineffective. Stopping the script right after discard will make sure no other actions can be triggered, thereby making sure the message is discarded (provided no earlier actions already triggered some sort of delivery either). Without discard or any other action command that cancels the implicit keep (such as redirect, fileinto, and ... keep), the default action is to "keep" the message, e.g. file it to INBOX.
Regards,
Stephan.
On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote:
Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
# rule:[blocks] if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; } # rule:[redir] if true { redirect "jorge@decimal.pt"; }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- dr Tóth Attila, Radiológus, 06-20-825-8057 Attila Toth MD, Radiologist, +36-20-825-8057
Hi all,
Well, my issue is not exacly what you descrived,
I have an account, that i want to forward all incoming emails, so far so good. Before the emails are forward, i want to delete some, based on the sender domain.
Thing is, i think managesieve roundcube plugin is producing the script wrong, here's what i have, i have 1 rule for the delete some senders, ok, and the 2nd for the redirect
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt", header :contains "from" "mcdonalds.pt") { discard; redirect "jorge@domain.pt"; }
rule:[redir]
if true { redirect "jorge@domain.pt"; }
On 2026-09-06 10:15, Tóth Attila via dovecot wrote:
I'm using a filter that moves the mail to another directory. The original message disappeared only from the initial location if imapsieve_expunge_discarded = yes was set. A duplicate remained otherwise. I suggest to take a look at on this configuration option depending on the purpose of the filter.
On 2026.09.06 02:30, Stephan Bosch via dovecot wrote: Op 2-9-2026 om 16:00 schreef Antonio Oliveira via dovecot: Hello,
You can try to add "stop;" after "discard;", so that rule processing stops after the discard and doesn't trickle down to the other rule.
Yes, this will help. Why? The discard action command only cancels the implicit keep; nothing else. It means that if and only if no other explicit action delivers or preserves (keeps!) the message somehow, it is discarded. So, if subsequently redirect is triggered, the message is redirected, thereby making the discard action ineffective. Stopping the script right after discard will make sure no other actions can be triggered, thereby making sure the message is discarded (provided no earlier actions already triggered some sort of delivery either). Without discard or any other action command that cancels the implicit keep (such as redirect, fileinto, and ... keep), the default action is to "keep" the message, e.g. file it to INBOX.
Regards,
Stephan.
On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote: Hi guys,
Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected.
Any idea what is wrong here?
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; }
rule:[redir]
if true { redirect "jorge@decimal.pt"; }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Hi all,
Well, my issue is not exacly what you descrived,
I have an account, that i want to forward all incoming emails, so far so good. Before the emails are forward, i want to delete some, based on the sender domain.
Thing is, i think managesieve roundcube plugin is producing the script wrong, here's what i have, i have 1 rule for the delete some senders, ok, and the 2nd for the redirect
rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt", header :contains "from" "mcdonalds.pt") { discard; redirect "jorge@domain.pt"; }
rule:[redir]
if true { redirect "jorge@domain.pt"; }
On 2026-09-06 10:15, Toth Attila via dovecot wrote:
I'm using a filter that moves the mail to another directory. The
original message disappeared only from the initial location if
imapsieve_expunge_discarded = yes was set. A duplicate remained
otherwise. I suggest to take a look at on this configuration option
depending on the purpose of the filter.
On 2026.09.06 02:30, Stephan Bosch via dovecot wrote:
Op 2-9-2026 om 16:00 schreef Antonio Oliveira via dovecot:
Hello,
You can try to add "stop;" after "discard;", so that rule processing
stops after the discard and doesn't trickle down to the other rule.
Yes, this will help. Why? The discard action command only cancels the
implicit keep; nothing else. It means that if and only if no other
explicit action delivers or preserves (keeps!) the message somehow, it
is discarded. So, if subsequently redirect is triggered, the message
is redirected, thereby making the discard action ineffective. Stopping
the script right after discard will make sure no other actions can be
triggered, thereby making sure the message is discarded (provided no
earlier actions already triggered some sort of delivery either).
Without discard or any other action command that cancels the implicit
keep (such as redirect, fileinto, and ... keep), the default action is
to "keep" the message, e.g. file it to INBOX.
Regards,
Stephan.
On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote:
Hi guys,
Small help with a sieve script, I have the script below in a
useraccount,
in this exact order.
The redirect works, but the discard doesn't.
A message that comes from the domain "clubefashing.com" or
"nutribody.pt",
is always redirected.
Any idea what is wrong here?
# rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header
:contains
"from" "nutribody.pt")
{
discard;
}
# rule:[redir]
if true
{
redirect "[1]jorge@decimal.pt";
}
_______________________________________________
dovecot mailing list -- [2]dovecot@dovecot.org
To unsubscribe send an email to [3]dovecot-leave@dovecot.org
_______________________________________________
dovecot mailing list -- [4]dovecot@dovecot.org
To unsubscribe send an email to [5]dovecot-leave@dovecot.org
References
Visible links
- mailto:jorge@decimal.pt
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
On 9/6/2026 9:48 PM, Jorge Bastos via dovecot wrote:
Hi all, Well, my issue is not exacly what you descrived, I have an account, that i want to forward all incoming emails, so far so good. Before the emails are forward, i want to delete some, based on the sender domain. Thing is, i think managesieve roundcube plugin is producing the script wrong, here's what i have, i have 1 rule for the delete some senders, ok, and the 2nd for the redirect # rule:[blocks] if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt", header :contains "from" "mcdonalds.pt") { discard; redirect "jorge@domain.pt"; } # rule:[redir] if true { redirect "jorge@domain.pt"; }
Hello,
if you want to forward all of the emails, regardless of the sender domain and then "delete" them from the original inbox I would do (option 1):
# rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header
:contains "from" "nutribody.pt", header :contains "from" "mcdonalds.pt") { redirect "jorge@domain.pt"; discard; stop; } # rule:[redir] if true { redirect "jorge@domain.pt"; stop; }
If, on the other hand you do not want do forward them and also do not want to keep them then simply do (option 2):
# rule:[blocks]
if anyof (header :contains "from" "clubefashion.com", header
:contains "from" "nutribody.pt", header :contains "from" "mcdonalds.pt") { discard; stop; } # rule:[redir] if true { redirect "jorge@domain.pt"; stop; }
option 1 - Email is redirected, discarded and rule processing stops (which inhibits the implicit "keep" from running, so the email is redirected to the other mailbox but not kept on the original one).
option 2 - Email from those domains is discarded and rule processing stops, again inhibiting the implicit keep. For the other domains, email is redirected and "implicilty" kept on the original mailbox.
if you're using roundcube you should have an action when creating the rule to "stop evaluating rules" or something else to that effect when creating the rule, that will add the "stop;" line on each rule. you just need to add it in the correct order to make it work.
In your first message you stated that you wanted to avoid having those blocked domain emails from being stored in the original mailbox, so option 2 should work correctly for that. The rules you have in this message will redirect both the "blocked" and all other emails to being redirected to the other mailbox, which is what option 1 gives you. With the rules you sent you would get *two* emails from the "blocked" domains being redirected to "jorge@domain.pt" since both rules would match.
Hope this clarifies and helps you achieve the desired outcome. Both are entirely possible with roundcube generated sieve rules, you just need to decide on which of the two you want.
Regards,
On 2026-09-06 10:15, Toth Attila via dovecot wrote: I'm using a filter that moves the mail to another directory. The original message disappeared only from the initial location if imapsieve_expunge_discarded = yes was set. A duplicate remained otherwise. I suggest to take a look at on this configuration option depending on the purpose of the filter. On 2026.09.06 02:30, Stephan Bosch via dovecot wrote: Op 2-9-2026 om 16:00 schreef Antonio Oliveira via dovecot: Hello, You can try to add "stop;" after "discard;", so that rule processing stops after the discard and doesn't trickle down to the other rule. Yes, this will help. Why? The discard action command only cancels the implicit keep; nothing else. It means that if and only if no other explicit action delivers or preserves (keeps!) the message somehow, it is discarded. So, if subsequently redirect is triggered, the message is redirected, thereby making the discard action ineffective. Stopping the script right after discard will make sure no other actions can be triggered, thereby making sure the message is discarded (provided no earlier actions already triggered some sort of delivery either). Without discard or any other action command that cancels the implicit keep (such as redirect, fileinto, and ... keep), the default action is to "keep" the message, e.g. file it to INBOX. Regards, Stephan. On 9/2/2026 1:05 PM, Jorge Bastos via dovecot wrote: Hi guys, Small help with a sieve script, I have the script below in a useraccount, in this exact order. The redirect works, but the discard doesn't. A message that comes from the domain "clubefashing.com" or "nutribody.pt", is always redirected. Any idea what is wrong here? # rule:[blocks] if anyof (header :contains "from" "clubefashion.com", header :contains "from" "nutribody.pt") { discard; } # rule:[redir] if true { redirect "[1]jorge@decimal.pt"; } _______________________________________________ dovecot mailing list -- [2]dovecot@dovecot.org To unsubscribe send an email to [3]dovecot-leave@dovecot.org _______________________________________________ dovecot mailing list -- [4]dovecot@dovecot.org To unsubscribe send an email to [5]dovecot-leave@dovecot.orgReferences
Visible links 1. mailto:jorge@decimal.pt 2. mailto:dovecot@dovecot.org 3. mailto:dovecot-leave@dovecot.org 4. mailto:dovecot@dovecot.org 5. mailto:dovecot-leave@dovecot.org
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- Anto'nio Henrique A. Proenca de Oliveira "Although we can never go back, like an old sweet song with a strong refrain, memories remain" - (Someone)
Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html $Id: .signature,v 1.5 2008/03/13 11:22:00 tat Exp tat $
participants (4)
-
Antonio Oliveira
-
Jorge Bastos
-
Stephan Bosch
-
Tóth Attila