EmailDiscussions.com

EmailDiscussions.com (http://www.emaildiscussions.com/index.php)
-   FastMail Forum (http://www.emaildiscussions.com/forumdisplay.php?f=27)
-   -   New rules and jmapquery (http://www.emaildiscussions.com/showthread.php?t=76254)

n5bb 31 Mar 2020 03:29 AM

New rules and jmapquery
 
After moving to the new rules system and moving to label mode (in beta late March 2020), with no rules I see the following base sieve:
Code:

require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", "mboxmetadata", "servermetadata", "date", "index", "comparator-i;ascii-numeric", "variables", "imap4flags", "editheader", "duplicate", "vacation-seconds", "fcc", "x-cyrus-jmapquery"];

### 1. Sieve generated for save-on-SMTP identities
# You do not have any identities with special filing.

### 2. Sieve generated for blocked senders
# You have no blocked senders.

### 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" "*"
    )
  {
    fileinto "\\Junk";
    stop;
  }
  if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "5" {
    fileinto "\\Junk";
    stop;
  }
}


### 4. User configured rules

### 4a. Calculate rule actions

# No user configured rules

### 4b. Rule sent message to trash
if string :is "${deletetotrash}" "Y" {
  fileinto "\\Trash";
}

### 4c. Rule says message is spam
elsif string :is "${spam}" "Y" {
  fileinto "\\Junk";
}

### 4d. Do rule actions
else {
  if string :is "${skipinbox}" "Y" {
    if string :is "${hasmailbox}" "Y" {
      discard;
    }
    else {
      fileinto "\\Archive";
    }
  }
  else {
    ### 4e. Sieve generated for fetch mail filing
    # You have no pop-links filing into special folders.
  }
 
  ### 5. Sieve generated for vacation responses
  # You do not have vacation responses enabled.
 
  ### 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";
  }
}

if string :is "${stop}" "Y" {
#  For backwards compatibility
}

If I add this one rule (everything else left at default):
Quote:

Matches subject:SNEEZE
Add label Testing - Continue to apply other rules
I then get the following sieve containing jmapquery in the ### 4a. Calculate rule actions code:

Code:

require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", "mboxmetadata", "servermetadata", "date", "index", "comparator-i;ascii-numeric", "variables", "imap4flags", "editheader", "duplicate", "vacation-seconds", "fcc", "x-cyrus-jmapquery"];

### 1. Sieve generated for save-on-SMTP identities
# You do not have any identities with special filing.

### 2. Sieve generated for blocked senders
# You have no blocked senders.

### 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" "*"
    )
  {
    fileinto "\\Junk";
    stop;
  }
  if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "5" {
    fileinto "\\Junk";
    stop;
  }
}


### 4. User configured rules

### 4a. Calculate rule actions

# Search: "subject:SNEEZE"
if
  allof( not string :is "${stop}" "Y",
    jmapquery text:
  {
    "subject" : "SNEEZE"
  }
.
  )
{
  set "L0_Testing" "Y";
 
}

### 4b. Rule sent message to trash
if string :is "${deletetotrash}" "Y" {
  fileinto "\\Trash";
}

### 4c. Rule says message is spam
elsif string :is "${spam}" "Y" {
  fileinto "\\Junk";
}

### 4d. Do rule actions
else {
  if string :is "${L0_Testing}" "Y" {
    set "hasmailbox" "Y";
    fileinto :copy "INBOX.Testing";
  }
  if string :is "${skipinbox}" "Y" {
    if string :is "${hasmailbox}" "Y" {
      discard;
    }
    else {
      fileinto "\\Archive";
    }
  }
  else {
    ### 4e. Sieve generated for fetch mail filing
    # You have no pop-links filing into special folders.
  }
 
  ### 5. Sieve generated for vacation responses
  # You do not have vacation responses enabled.
 
  ### 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";
  }
}

if string :is "${stop}" "Y" {
#  For backwards compatibility
}

I hope this helps those wondering about how jmapquery appears in the new rules system.


Bill

xyzzy 31 Mar 2020 04:36 AM

I'm out of ideas as to why I cannot reproduce it.

Back in January I submitted a ticket asking about the appearance of x-cyrus-jmapquery in the require list. I just reopened that ticket to ask about what triggers the jmapquery vs. header test. Stay tuned...

gardenweed 31 Mar 2020 09:40 AM

Having removed my custom sieve from my rules, I still cannot upgrade to the new rules.

n5bb 31 Mar 2020 11:38 AM

Beta new rules and labels
 
Quote:

Originally Posted by gardenweed (Post 614979)
Having removed my custom sieve from my rules, I still cannot upgrade to the new rules.

Custom sieve didn't affect my upgrading to the new rules system, so I'm not sure why you think that might be an issue. At this time, I have updated all of my accounts to the new rules and label mode. I'm not sure if these features have been rolled out to all users, since it's still in beta. But here are some questions which might indicate why you are having difficulty:
  • What is your account level?
  • Log into beta.fastmail.com and go to the Settings>Rules screen. At the top of that screen you should see a line titled:
    "Fastmail is improving the way rules and filters work. Learn more and upgrade"
    • Do you see that link (Learn more and upgrade)? If so, what happens if you click it and then choose to upgrade? Do you get an error message?
    • If you don't see the upgrade information at the top of the page while you are logged into beta, then your account (or account level) isn't offering the new features yet.
  • After you have upgraded to the new rules, the rules designation in the Settings screen will change to Filters & Rules (instead of the old Rules). You will also be able to use labels by switching at: Settings>Customize>Preferences>Mail>Labels
Bill

xyzzy 31 Mar 2020 12:05 PM

When you click learn more and upgrade (assuming it's there) is the activate new rules button disabled and a message at the top indicating a reason? If so do you have any custom sieve code in either or both the sieve user edit blocks before ("old") sieve code section 4 (Sieve generated for forwarding rules) and/or section 6 (Sieve generated for calendar preferences)? If so that was my problem until n5bb cued me on to what was causing the problem. Remove (or move) that code and the activate button should be enabled.

Note the reason for this is the edit block before section 6 no longer exists in the new sieve code. Oddly there still is a edit block before the new section 4 so I don't know why the upgrade should complain about that one but it does. Also be careful about making any changes to the new sieve code since you will lose it if you revert back to the old code.

n5bb 31 Mar 2020 12:07 PM

Quote:

Originally Posted by xyzzy (Post 614983)
Is the upgrade button disabled? If so do you have any custom sieve code in either or both the user edit blocks before sieve section 4 (Sieve generated for forwarding rules) and/or section 6 (Sieve generated for calendar preferences)? If so that was my problem until n5bb cued me on to what was causing the problem. Remove that code and the upgrade button will be enabled.

Oh ... I didn't know that that old sieve was really a problem. How did this show up? Which screen had the disabled button?

gardenweed 31 Mar 2020 12:19 PM

Yes I get the message at the top of the upgrade screen:

Quote:

Sorry, we can’t upgrade you yet. You have custom Sieve code that may interact with our new rules system. We will be checking these and enabling upgrading in the future. If you would like to upgrade now, please remove any custom Sieve code from the middle of our generated Sieve blocks, or contact support for assistance.
And the upgrade button is greyed out.

I removed the custom sieve but the message remains.

n5bb 31 Mar 2020 12:30 PM

Ah! I didn't know about that sieve limitation, since I didn't have custom code in those locations. The old system let you put custom code in several places which are no longer allowed.


Bil

xyzzy 31 Mar 2020 12:39 PM

Quote:

Originally Posted by gardenweed (Post 614985)
I removed the custom sieve but the message remains.

Should work. That error message is the same one I was getting. Are you should you removed all the text in those two sections including blank lines? If all if it is removed you should see "(Insert Sieve code here)" in light grey in those sections.

xyzzy 31 Mar 2020 12:41 PM

Quote:

Originally Posted by n5bb (Post 614986)
Ah! I didn't know about that sieve limitation, since I didn't have custom code in those locations. The old system let you put custom code in several places which are no longer allowed.

You were the one that cued me to the problem when you posted in that other thread what user blocks existed in the new code.;)

gardenweed 31 Mar 2020 01:06 PM

Quote:

Originally Posted by xyzzy (Post 614987)
Should work. That error message is the same one I was getting. Are you should you removed all the text in those two sections including blank lines? If all if it is removed you should see "(Insert Sieve code here)" in light grey in those sections.

Blank lines! :eek:
Yes. That was it. :)
Removed them and the button is now active.
Thanks.

JamesHenderson 31 Mar 2020 07:40 PM

Quote:

Originally Posted by gardenweed (Post 614979)
Having removed my custom sieve from my rules, I still cannot upgrade to the new rules.

I found. that I still had one single <enter> that prevented me from upgrading. Can you see the words (Insert Sieve code here) in each slot?

Edit: sorry - I added this before realising that you had sorted it already

SideshowBob 31 Mar 2020 09:57 PM

Quote:

Originally Posted by n5bb (Post 614986)
Ah! I didn't know about that sieve limitation, since I didn't have custom code in those locations. The old system let you put custom code in several places which are no longer allowed.

So where would the custom sieve get inserted in the script at the start of this thread.

xyzzy 1 Apr 2020 04:58 AM

Quote:

Originally Posted by SideshowBob (Post 614991)
So where would the custom sieve get inserted in the script at the start of this thread.

As I said earlier the only places it doesn't "like" when switching from "old" to "new" are the edit blocks before the "old" sieve code section 4 (Sieve generated for forwarding rules) and section 6 (Sieve generated for calendar preferences? The "old" blocks at the beginning and end are preserved. And the new code does have an edit block before the "new" section 4 (User configured rules).

Also remember that if you use that "new" block before section 4 you will lose what you put in there should you decide to want to switch back to the "old" code for some reason. They snapshot your "old" sieve script at the time you switch from "old" to "new" and restore from it if you switch back from "new" back to "old".

Bottom line, the stuff you added at the beginning and end might still be ok.

xyzzy 2 Apr 2020 04:13 AM

Quote:

Originally Posted by xyzzy (Post 614975)
I'm out of ideas as to why I cannot reproduce it.

Back in January I submitted a ticket asking about the appearance of x-cyrus-jmapquery in the require list. I just reopened that ticket to ask about what triggers the jmapquery vs. header test. Stay tuned...

Finally got a response on my ticket on why I don't ever see jmapquery's. It's because it never occurred to me different sieve code for conditions would be generated when you create a rule using no-preview mode as opposed to the new preview mode. I wasn't using preview mode in all my testing since I dislike its UI. But as it turns out creating a rule in preview mode causes the jmapquery to be generated. I suppose checking, say for Subject, with a jmapquery is the same as using a header :contains created with no preview mode. Oh well, it is what it is.:(


All times are GMT +9. The time now is 10:46 AM.


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