![]() |
|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
![]() |
|
Thread Tools |
![]() |
#1 |
Essential Contributor
Join Date: Sep 2002
Posts: 345
|
![]() I have some rules setup but the emails often go to spam and thus it seems the rules never get applied. My understanding is that to fix this I would have to edit the Sieve script?
Once I start editing the Sieve, can I still use the web interface to add/edit rules? I am not much of a coder and prefer the web interface to manage my rules rather than having to edit a text file each time. Any suggestions for the best way to you about this? (Btw, the rule I am trying to create is for emails with a specific TO/CC/BCC address to go straight to the trash.) |
![]() |
![]() |
![]() |
#2 |
Essential Contributor
Join Date: May 2018
Posts: 486
|
Short answer: Your mail rules specified in the UI are always handled after the spam threshold tests.
Long answer: Open your "Mail rules" page and click "Edit custom Sieve code" to see your sieve script. In the sieve script you will see the code for the rules you created in the UI (starting with the comment "### Calculate rule actions") are located after the section that starts with "### Sieve generated for save-on-SMTP identities {{{". You will see that the "Spam Protection" value tests are done before the mail rules. Before the "### Sieve generated for save-on-SMTP identities {{{" section (and after it too) you will see a blank area where you can add your own code. So in you specific case add the sieve code in the blank area before the "### Sieve generated for save-on-SMTP identities {{{" section. That way it will always be done no matter what the spam score is. If you don't know how to code sieve then create a rule in your UI like a normal rule as a example just to see what sieve code is generated for the tests. All you need do is the same tests and for the true part add, fileinto "\\Trash"; stop; So those emails that satisfy the tests will file those messages into the trash and stop the script so it never executes the stuff that follows. Last edited by xyzzy : 3 Jan 2025 at 08:03 PM. |
![]() |
![]() |
![]() |
#3 |
Essential Contributor
Join Date: Sep 2002
Posts: 345
|
Thank you xyzzy!
|
![]() |
![]() |
![]() |
#4 |
Essential Contributor
Join Date: Sep 2002
Posts: 345
|
hmm, I thought it was working but it is not -- emails are still ending up in spam, rather than the trash.
Originally I was using Code:
if address :is ["to", "cc", "bcc"] Code:
require ["fileinto"]; if header :is "X-Delivered-To" "abc@xyz.com" { fileinto "\\Trash"; } elsif header :is "X-Delivered-To" "def@xyz.com" { fileinto "\\Trash"; stop; } When I paste my code and a raw message with one of those email addresses into the tester, it says "filing message into '\Trash'" But again, these message are ending up in Spam not trash. ![]() ![]() ![]() |
![]() |
![]() |
![]() |
#5 |
Essential Contributor
Join Date: May 2018
Posts: 486
|
I'll ignore that if address construct since I'm not sure where you were going with that one. As for the one that uses the X-Delivered-to's it should work if X-Delivered-to is def@xyz.com but as written it will not stop for abc@xyz.com so execution will reach the later spam score checking which is what I think you are seeing.
The way you indented that stop command I assume you intended it to apply to all the individual address tests when they match but you only have it in the true block of the def@xyz.com (2nd) test. That's correct but you need a stop for each individual test when true. So properly indented it should look something like: Code:
require ["fileinto"]; if header :is "X-Delivered-To" "abc@xyz.com" { fileinto "\\Trash"; stop; } elsif header :is "X-Delivered-To" "def@xyz.com" { fileinto "\\Trash"; stop; } Code:
require ["fileinto"]; if header :is "X-Delivered-To" ["abc@xyz.com", "def@xyz.com"] { fileinto "\\Trash"; stop; } Code:
require ["fileinto"]; if header :is "X-Delivered-To" ["abc@xyz.com", "def@xyz.com"] { fileinto "\\Trash"; stop; } Last edited by xyzzy : 7 Jan 2025 at 08:06 PM. |
![]() |
![]() |
![]() |
Thread Tools | |
|
|