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 31 Mar 2017, 01:01 AM   #1
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Priority of sieve rules (manually scripted vs. widget created)

Good day.

Over the years, I have scripted many handwritten sieve rules. Some of them are so old that I forget why I scripted them in the first place.

Over the next few weeks, I would like to "clean-up" all the rules, including, splitting some long and cumbersome ones.

I'm pondering whether or not to start using the rules widget. Before I do so, I would like to know which rules take precedence, the ones manually scripted or the ones created with the widget.

For example, if I manually script a rule to store (fileinto) all messages from Bob @ domain.invalid in the "INBOX.Bob" directory (and stop) and create a similar rule with the widget to store all similar messages in the "INBOX.Robert" directory (and stop) , which rule would take precedence?

Thank you.

--
Jacinto
Jacinto is offline   Reply With Quote

Old 31 Mar 2017, 01:54 AM   #2
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,084
There is no simple answer to your question. As a first step in sorting things out, go to Settings->Rules and click on Edit custom sieve code. You can see from the screen that shows how your custom sieve snippets fit around the automatically generated sieve code. If, as I suspect, your current sieve is a bit of a mess, you may find it useful to use the Copy to clipboard feature and past the script into a document file or similar, or print it if preferred. You can then mark it up with your planned cleanup steps.
I do highly recommend that you use rules most of the time. Only in some rare cases is custom sieve necessary or desirable.
BritTim is offline   Reply With Quote
Old 31 Mar 2017, 02:18 AM   #3
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Thank you, BritTim.

Actually, I have all my sieve rules stanzas backed-up as text files on my box. As you know, it's a lot easier to clean them up with a text editor than on the browser screen.

At present, I don't have any widget created rules, hence, the purpose of starting this thread.

When I became a FastMail subscriber years ago, the rules widget was very rudimentary, perhaps it's more advanced now. I could not have accomplished my filtering preferences back then, except by scripting my own sieve rules.

If, in fact, I'm able to create the same handwritten rules with the rules widget, I would follow your suggestion and use it exclusively after I create all the rules that I need with the widget. If for no other reason, than that it should be easier to do so with the widget.

We'll see.

I still would like to know which rules take precedence before I start using the widget.

--
Jacinto
Jacinto is offline   Reply With Quote
Old 31 Mar 2017, 05:49 AM   #4
jhollington
Essential Contributor
 
Join Date: Apr 2008
Posts: 371
Quote:
Originally Posted by Jacinto View Post
When I became a FastMail subscriber years ago, the rules widget was very rudimentary, perhaps it's more advanced now. I could not have accomplished my filtering preferences back then, except by scripting my own sieve rules.
Yes, it's considerably more advanced than it used to be, and most importantly it's much more practical to use custom sieve rules along with the "widget-created" (automatically generated) ones. If I recall correctly, in the early days that was something of an "either-or" choice.

Quote:
I still would like to know which rules take precedence before I start using the widget.
As I think BritTim more or less pointed out, you can see this if you simply go into the Edit Custom Sieve Code link.

On this screen, you should see grey blocks that show you the automatically generated Sieve rules, with editable sections in between that allow you to insert custom blocks of sieve code in between the pre-defined and widget-created rules.

In the second grey block down, among other things you'll see a couple of lines like this:

Code:
### 2. Sieve generated for discard rules
# You do not have any discard rules.
This is where automatically generated "Discard" rules (ones created from the "widget" to use your terminology) will appear.

Then, in the next grey block down, you should see two sections like this:

Code:
### 4. Sieve generated for forwarding rules
# You do not have any forwarding rules.

### 5. Sieve generated for vacation responses
# You do not have vacation responses enabled.
Which, similarly, would be where your "widget-created" forwarding and vacation-response rules would appear.

Then, among other things in the next block after that come the place where automatically-generated filing rules get inserted..

Code:
### 7. Sieve generated for organise rules
# You have no organise rules.

### 8. Sieve generated for pop-link filing
# You have no pop-links filing into special folders.
So when you create rules from the "widget," they appear in the appropriate sections here, in their raw Sieve-language form. You can pretty much figure out and determine your own precedence from there — if you have a manual rule that you want to take precedence, just place it in one of the editable blocks above the section that contains the automatically-generated rules, and anything lower priority can go below.

Last edited by jhollington : 31 Mar 2017 at 05:54 AM.
jhollington is offline   Reply With Quote
Old 31 Mar 2017, 06:46 AM   #5
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Thank you, jhollington.

Your detailed explanation makes clearer what BritTim was referring to.

I suppose that I'll have to reread your answer a few times and add some test rules until I get the gist of it (or forget about the widget and clean-up my hand scripted rules).

Either way, I need to organize my rules sooner rather than later.

Thank you again.

--
Jacinto
Jacinto is offline   Reply With Quote
Old 31 Mar 2017, 01:31 PM   #6
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,917
Arrow Improvements to both sieve language support and rules system

FastMail has made major improvements to their sieve language support and to their rules features in the past few months. For example, you can now easily make a new rule while reading an email, based on the contents of that message.

As pointed out by others, your sieve script consists of the Settings>Rules choices, spam filtering and a few miscellaneous automatic rules, and your custom sieve additions between the automatic blocks. The execution order is sequential, so there is no priority other than that set by the ordering of the sieve statements and stop statements which prevent later steps from being executed. You can prevent automatically generated blocks from executing by encasing the block as described in this post:
How to bypass spam filtering for certain addresses

Here are some additional references you might want to read. You can also find much more by searching for "sieve" in the help system. The notify sieve support has been completely rewritten and now supports several popular web services which perform automatic actions when triggered by a sieve command.Bill
n5bb is offline   Reply With Quote
Old 31 Mar 2017, 10:07 PM   #7
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Thanks to all who replied.

I've decided not to bother using the widget.

My hand scripted sieve rules have served me well for all this years and there is no purpose in reinventing the wheel at this time.

All I need to do is delete the ones that no longer have any use, split the ones that are too long and complicated, and make sure they are all in the order I want them to be.

I'll leave it to others to play with the widget.

--
Jacinto
Jacinto is offline   Reply With Quote
Old 1 Apr 2017, 12:44 AM   #8
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Hello.

Started the clean-up this morning.

Found the following two enabled sieve generated rules (that I did not script) at the top of the sieve rules (there were others, but they were disabled):

Code:
### 3. Sieve generated for spam protection
if not header :matches "X-Spam-Known-Sender" "yes*" {
  if 
    allof(
    header :contains "X-Backscatter" "yes",
    not header :matches "X-LinkName" "*",
    not header :contains "X-Backscatter-Hosts" ["smtp.[XXXX].com","smtp.[XXXX].org","[XXXX].[XXXX].com"]
    )
  {
    fileinto "\\Junk";
    stop;
  }
  if anyof(header :value "gt" :comparator "i;ascii-numeric" "X-Spam-score" "5", header :regex "X-Spam-score" "^5\.[1-9]$") {
    fileinto "\\Junk";
    stop;
  }
}
Code:
### 6. Sieve generated for calendar preferences
if 
  allof(
  header :is "X-ME-Cal-Method" "request",
  not exists "X-ME-Cal-Exists",
  header :contains "X-Spam-Known-Sender" "in-addressbook"
  )
{
  notify :method "addcal";
}
elsif exists "X-ME-Cal-Exists" {
  notify :method "updatecal";
}
The first one has to do with my Spam classification settings and I'm going to leave it alone.

The second one appears to deal with making or updating calendar entries from received E-Mail messages.

I don't really use the calendar and don't want anyone else making or attempting to make calendar entries, hence, unless if by doing so the Earth would stop spinning or the Atlantic Ocean would drain, I'll comment (disable) it.

--
Jacinto

P.S.: No can do -- the rule's text can't be edited.

Last edited by Jacinto : 1 Apr 2017 at 12:53 AM.
Jacinto is offline   Reply With Quote
Old 1 Apr 2017, 02:17 AM   #9
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,084
To disable snippets of automatically generated sieve code, you need to enclose it with custom sieve. Before it, have the custom sieve
Code:
if false {
After have simply the custom code
Code:
}
I note in passing that, though you are free to implement as you deem fit, the use of any custom sieve makes you more vulnerable as the system changes in the future. If you suffer an upwards compatibility issue, this can go unnoticed for a long time. By using FastMail's Rule system, you ensure that the task of ensuring long term upwards compatibility is firmly in FastMail's court.
BritTim is offline   Reply With Quote
Old 1 Apr 2017, 04:35 AM   #10
Jacinto
Essential Contributor
 
Join Date: Jun 2009
Posts: 395
Quote:
Originally Posted by BritTim View Post
To disable snippets of automatically generated sieve code, you need to enclose it with custom sieve. Before it, have the custom sieve
Code:
if false {
After have simply the custom code
Code:
}
Done, thank you kindly, BritTim.

Of course, I have no way to test it.

Quote:
Originally Posted by BritTim View Post
I note in passing that, though you are free to implement as you deem fit, the use of any custom sieve makes you more vulnerable as the system changes in the future. If you suffer an upwards compatibility issue, this can go unnoticed for a long time. By using FastMail's Rule system, you ensure that the task of ensuring long term upwards compatibility is firmly in FastMail's court.
I understand that you are recommending what would be called "Best Practices" and thank you for it.

Having said that and as I said earlier, my handwritten rules have served me well for many years and they still work as I want them to.

Personally, I don't believe that Fastmail is going to abandon sieve or deviate from the standards. If it does, I'll just use an IMAP filtering application that I have used successfully in the past:

https://github.com/lefcha/imapfilter

Hopefully, I won't have to.

By the way, while Fastmail was owned by Opera, especially when it was rumored that Opera was being sold to Facebook, I set up accounts with other mail hosts. However, none of them had FM's filtering capabilities or even came close.

Fortunately, I didn't have to change hosts and don't believe I'll have to in the near future.

--
Jacinto
Jacinto 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 07:37 PM.

 

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