|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
|
Thread Tools |
4 Nov 2024, 07:56 AM | #1 |
Junior Member
Join Date: Oct 2024
Location: Sydney/Australia
Posts: 4
|
Sieve Filter not working
Hi all,
I have this Sieve to stop a couple of know spam senders and it is not working as expected. The mail is still ending up in the Spam Folder. The filter is placed at the very top before the spam section so should be catching the mail before the Spam section. But it is not. TIA Code:
## Known Spam if address :is "From" [ "user1@domain1.com", "user2@domain2.com" ] { discard; } |
4 Nov 2024, 09:38 AM | #2 |
Intergalactic Postmaster
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
|
Stop execution after discard
Welcome to the EMD Forums!
I suggest you add stop; after the discard; statement, as shown in this example. Otherwise later rules will be executed (such as filing into the spam folder). The discard is not executed until the end of the rules execution and just prevents that message from arriving in your Inbox. Code:
## Known Spam if address :is "From" [ "user1@domain1.com", "user2@domain2.com" ] { discard; stop; } |
4 Nov 2024, 09:52 AM | #3 |
Junior Member
Join Date: Oct 2024
Location: Sydney/Australia
Posts: 4
|
Hi,
Thanks for your reply, however I don't think your solution will work for me. Reason, I just changed one of the email addresses, without adding the stop, to my gmail address and mail never arrives into any folder. So the rule seems to work. However, it fails when mail is from a known spammer. Seems the Sieve is not finding the address in the Spam Email and is therefore moving on to the next Sieve element and therefore is detected as Spam and placed into the Spam folder. Thoughts? |
4 Nov 2024, 10:22 AM | #4 |
Intergalactic Postmaster
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
|
Have you added the stop; as I suggested and still found those messages are not discarded? Please try this.
It fails when there is no stop; and the rules continue to file the message as spam. There really isn’t any reason to not add stop: after any discard; statement if you truly don’t want any messages from those senders to be saved. Bill |
4 Nov 2024, 10:25 AM | #5 |
Junior Member
Join Date: Oct 2024
Location: Sydney/Australia
Posts: 4
|
Yes, I did add the stop and Spam is still going to the Spam Folder when the sender is contained within the Sieve Filter.
|
4 Nov 2024, 10:31 AM | #6 |
Intergalactic Postmaster
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
|
Are you sure that this code with discard; and stop; are before all other Sieve statements?
This is a pain to test because you have to generate a test message, and marking it as spam can be bad if it is from an address you own and use, but I might be able to find a way to safely test this later. Bill |
4 Nov 2024, 10:38 AM | #7 | |
Junior Member
Join Date: Oct 2024
Location: Sydney/Australia
Posts: 4
|
Quote:
Regarding the stop; I hear what you are saying and the stop; will do no harm. But surely the discard; is going to remove the email so no further processing can be done on the email. As it's deleted. But, just to be sure I've added a stop; as you suggested. Thanks for your input Bill. Greg EDIT: Seems adding the stop; has fixed the issue. Must have done something wrong earlier, sorry. Thanks once again for all your assistance. Last edited by gregeeh : 4 Nov 2024 at 01:01 PM. |
|
4 Nov 2024, 01:19 PM | #8 | |
Intergalactic Postmaster
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
|
Quote:
To understand why the stop is needed, see these sections of the Sieve standard: Implicit keep Action discard Control stop The way this works is that the discard action does not actually delete the message. All discard does is to cancel the implicit keep when the Sieve script terminates. So later Sieve statements (such as spam filtering) can do things with the message unless the script is forced to stop immediately after the discard action. Bill |
|
Thread Tools | |
|
|