Sieve:addflag command not working
Hi there,
It's been ages since I've posted here, but I'm wondering about FastMail's implementation of Sieve's addflag command for flagging messages with IMAP standard flags. I have recently reworked my Sieve script to try and use addflag with a view to using them with the new saved search feature. But it looks like addflag only works on messages filed to INBOX, because I see no evidence of flags being set on the majority of my messages, which are filed to various mailboxes (based on an elaborate subdomain and address naming convention I have going). However, today I noticed that some of the very few messages that get filed into the top-level INBOX do have flags set. So does anyone know how, with a Sieve script on FastMail, to conditionally add IMAP flags to messages and have them filed into specific mailboxes? What am I missing? I haven't studied every line of the relevant RFCs, but I saw nothing that said that addflag should be restricted to the INBOX. Does anyone else have a Sieve script doing anything like this? |
My script under some conditions files into spam with addflag "\\Seen" and works as expected. Not sure why it wouldn't work for any folder since the addflag is done before the fileinto and knows nothing about the final disposition of the message when the addflag is done.
You said you reworked your sieve script. Maybe it has a bug. Have you tried it in Sieve Tester with a test case to see if its going down the expected path? When I am not sure of where a case is going I debug it in sieve tester by sprinkling fileinto's in places I expect the test case to go. Since sieve tester doesn't care what you use for folder names I specifiy "point1", "point2", etc. as fileinto folder names just to see it goes down the expected path. The results of these fileinto's will display in the sieve tester results. The addflag's are reported in the results too (at least seen is). Note, if you do copy your entire sieve script into sieve tester you must remove the "fcc" at the end of the require command since FM never updated sieve tester to support it. I submitted a ticket on this some time ago but FM just doesn't consider sieve tester a priority worth updating since they think so few users deal with sieve scripts.:( I am not in a position to argue with that. |
Thanks for the quick reply. It is good to have at least one data point validating that what I am doing should work. One difference is that I don't do an explicit fileinto after adding the flag, because FastMail's setup does an implicit fileinto in subfolders due to the way they support plus addressing. But still, it should all amount to the same thing: a message with flags set that eventually is filed into a mailbox.
I will try the Sieve tester again. I had used it before, but not recently. That's sensible advice. I'm pretty sure the script is hitting the paths I expect, because I've also made use of the addheader command to mark tracepoints in a way analogous to your extra fileinto commands in a test script. |
Quote:
Go figure. It's not a syntax error, because the way my script fails would be totally different (in fact, I believe I wouldn't even be allowed to save a script with a syntax error). Next thing to see is if it's the details of my addheader commands at fault, or whether there's a fundamental incompatibility between the two extensions. The latter would, in my opinion, be a bug. The odd thing is that I'm pretty sure I only added the addheader commands to trace my script, to see why addflag wasn't working. Chicken. Egg. Update: Works: Code:
require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", Code:
require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", |
I thought it should have "imap4flags
|
Quote:
It turns out the addheader breaks other Sieve extension commands (like fileinto) so I really think the editheader extension is the culprit here. |
yea did not realise I had to scroll :D I am having a bad day.:)
|
Quote:
|
Slightly off topic but I just want to verify is that require list you show is with fcc edited out? If not then I am curious why FM's sieve always is generating it for me since I don't have anything that would require it.
Also what's the effect of \\flagged? I searched for it and while I keep finding examples of it I am curious what it's effect is? Update: I think I found it in rfc3501 section 2.3.2. |
Quote:
Quote:
Anyway, I have a further update. I removed all the addheader commands from my live FastMail copy of the Sieve script, and it's still not setting any flags. Copy the same script into the Sieve tester and it claims it will add the flag. |
Quote:
Code:
if allof(true, header :contains "Subject" "test") { Oddly though when I tested just this with sieve tester I got no results at all!:confused: I think that's a sieve tester bug. The addheader confuses it. |
Quote:
|
Yay! Keep us updated, please!
|
Quote:
|
All times are GMT +9. The time now is 05:38 PM. |
Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy