|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
|
Thread Tools |
11 Jan 2022, 03:36 AM | #1 | |
Junior Member
Join Date: Oct 2004
Posts: 20
|
Sieve rule on attachment types without mime extension
Any idea how I could filter on attachment mime type in Sieve?
I have been trying to create a custom sieve rule to handle emails containing iCalendar attachments according to RFC6047, i.e. bearing attachments with a Content-Type of "text/calendar". I have not managed to find any hints in this Fastmail Forum yet, but another forum's post led me to Sieve Extensions for Mime in RFC5703 which would allow me to use Code:
require ["mime", "fileinto"]; if header :mime :anychild :contenttype "Content-Type" "text/calendar" Quote:
Does anyone have any other suggestions of how I could go about forwarding just the emails containing iCalendar attachments to the external calendar provider I am required to use? Thanks. PS: I did try if header :matches "X-Attached" [".ics"] which works ok with Google calendar objects having the X-Attached: invite.ics header, but this does not with Microsoft calendar objects that just have the separate mime parts. Last edited by ArtMG : 11 Jan 2022 at 04:05 AM. Reason: extra info |
|
11 Jan 2022, 04:26 AM | #2 |
Junior Member
Join Date: Oct 2004
Posts: 20
|
Use the headers added by FM for invitation processing
Self-answer here, as I spotted a big clue lurking in the bottom of my FM autogenerated sieve code under section
Code:
### 6. Sieve generated for calendar preferences Code:
if exists "X-ME-Cal-Method" |
11 Jan 2022, 10:16 AM | #3 |
Cornerstone of the Community
Join Date: Jun 2008
Location: Perth
Posts: 664
|
Thanks for sharing
|
12 Jan 2022, 02:17 AM | #4 | |
Essential Contributor
Join Date: Dec 2017
Location: Scotland
Posts: 484
|
Quote:
I've never used the Sieve Tester but I have noticed that it gets mentioned every so often. Unfortunately I'm fairly sure that that's been in discussions about how (a) it doesn't work very well, and (b) that Fastmail have decided not to keep it uptodate. If both those things are still true then errors from it might be misleading. |
|
12 Jan 2022, 06:25 AM | #5 | |
Essential Contributor
Join Date: May 2018
Posts: 474
|
Quote:
Example: Code:
require ["fileinto", "mailbox", "editheader", "mailboxid"]; addheader "x" "point1"; if false {if mailboxidexists "xxx" {addheader "x" "point2";}} if false {if mailboxexists "xyz" {addheader "x" "point3";}} addheader "x" "point4"; But having Sieve Testers is better than nothing or having to run the actual script sprinkled with additional trace displays (addheaders usually) and sending test cases that you have to compose and send to yourself. In a old ticket I once asked why they don't really maintain Sieve Tester and was told they had plans to rewrite it. That was years ago now. They say very few of their users ever write their own Sieve code so it's low priority and they never seem to make any time to work on it. From what I can tell the only changes they make is to fix the require command so it doesn't choke on new extensions that FM might add to their boiler plate code (e.g., the JMAP additions). Last edited by xyzzy : 12 Jan 2022 at 06:38 AM. |
|
12 Jan 2022, 07:25 PM | #6 | ||
Junior Member
Join Date: Oct 2004
Posts: 20
|
Sieve Tester now presumes less
Quote:
Quote:
It may reassure you to hear they have changed their tack, maybe to prevent Sieve Tester from drifting too far from their production environment. Now, when you manually Edit custom Sieve Script rules, you will see the first block in (uneditable) grey is the current require []; statement - presumably listing all the Extensions currently supported in production. When you go to run Sieve Tester there is NO built in require statement. This means that the requires is always explicit, which forces you to build your own - or, better, copy it from your Sieve editor instance. That way you are testing against the same set of Sieve Extensions that are in production (give or take versions). Just in case I tried adding require ["mime"]; into my real Sieve Script and it failed with the same error as in the Sieve Tester (line X: Unsupported feature(s) in "require": "mime") whereas require ["fileinto"]; worked fine. This satisfied me that the real Sieve Script fails in the same way the tester did in my first post. |
||
13 Jan 2022, 06:19 AM | #7 | |
Essential Contributor
Join Date: May 2018
Posts: 474
|
Quote:
I'm doing this from memory so I could be wrong but if I recall I believe the Sieve standard specifies a core set of of extensions any Sieve interpreter needs to support and (lucky for me) "encoded-character" happens to be one of them (or it might be that one just happens to be mentioned in the rfc5228 standards spec). So while the FM generated require is all the extensions FM will ever need for it's UI functions the fact that I could add "encoded-character" means it's not all the extensions their Sieve interpreter supports. So as you did all you can do is try it in Sieve Tester to see if it errors out. Last edited by xyzzy : 13 Jan 2022 at 06:31 AM. |
|
Thread Tools | |
|
|