António,
Oh, i'm so sorry for the question and the time of you all. Yes, i'm missing the stop on the 1st rule, sieve executes them from top to bottom.
Solved, and thank you all for the time,
On 2026-09-06 22:14, Antonio Oliveira via dovecot wrote:
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.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
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Antonio,
Oh, i'm so sorry for the question and the time of you all. Yes, i'm missing the stop on the 1st rule, sieve executes them from top to bottom.
Solved, and thank you all for the time,
On 2026-09-06 22:14, Antonio Oliveira via dovecot wrote:
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 "[1]jorge@domain.pt";
}
# rule:[redir]
if true
{
redirect "[2]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 "[3]jorge@domain.pt";
discard;
stop;
}
# rule:[redir]
if true
{
redirect "[4]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 "[5]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 "[6]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][7]jorge@decimal.pt";
}
_______________________________________________
dovecot mailing list -- [2][8]dovecot@dovecot.org
To unsubscribe send an email to [3][9]dovecot-leave@dovecot.org
_______________________________________________
dovecot mailing list -- [4][10]dovecot@dovecot.org
To unsubscribe send an email to [5][11]dovecot-leave@dovecot.org
References
Visible links
1. mailto:[12]jorge@decimal.pt
2. mailto:[13]dovecot@dovecot.org
3. mailto:[14]dovecot-leave@dovecot.org
4. mailto:[15]dovecot@dovecot.org
5. mailto:[16]dovecot-leave@dovecot.org
_______________________________________________
dovecot mailing list -- [17]dovecot@dovecot.org
To unsubscribe send an email to [18]dovecot-leave@dovecot.org
References
Visible links
- mailto:jorge@domain.pt
- mailto:jorge@domain.pt
- mailto:jorge@domain.pt
- mailto:jorge@domain.pt
- mailto:jorge@domain.pt
- mailto:jorge@domain.pt
- mailto:jorge@decimal.pt
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
- mailto:jorge@decimal.pt
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
participants (1)
-
Jorge Bastos