EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Stay in touch wirelessly

FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc.

Reply
 
Thread Tools
Old 4 Nov 2024, 07:56 AM   #1
gregeeh
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;
}
gregeeh is offline   Reply With Quote

Old 4 Nov 2024, 09:38 AM   #2
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
Arrow 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;
}
Bill
n5bb is offline   Reply With Quote
Old 4 Nov 2024, 09:52 AM   #3
gregeeh
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?
gregeeh is offline   Reply With Quote
Old 4 Nov 2024, 10:22 AM   #4
n5bb
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
n5bb is offline   Reply With Quote
Old 4 Nov 2024, 10:25 AM   #5
gregeeh
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.
gregeeh is offline   Reply With Quote
Old 4 Nov 2024, 10:31 AM   #6
n5bb
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
n5bb is offline   Reply With Quote
Old 4 Nov 2024, 10:38 AM   #7
gregeeh
Junior Member
 
Join Date: Oct 2024
Location: Sydney/Australia
Posts: 4
Quote:
Originally Posted by n5bb View Post
Are you sure that this code with discard; and stop; are before all other Sieve statements?

Bill
100%. It's on the very top before the Spam Section.

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.
gregeeh is offline   Reply With Quote
Old 4 Nov 2024, 01:19 PM   #8
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 9,017
Quote:
Originally Posted by gregeeh View Post
... Seems adding the stop; has fixed the issue. Must have done something wrong earlier, sorry. Thanks once again for all your assistance.
You are quite welcome, Greg.

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
n5bb is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 02:52 AM.

 

Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy