Jakobus Schürz
2018-Dec-04 13:06 UTC
set seen flag and junk moving a mail manually to JUNK
Hi Ralph!
This is, what calls the correct sive-filter rules. I have that already
in use.
But the file
file:/etc/dovecot/sievepipe/report-spam
contains my sieve-script from my first posting.
So, the difference from setflag to addflag is, setflag sets the flags,
and only the given flags (removing all other flags), and addflag adds a
flag to the existing flags...
I fiddled around a little...
The sieve-script sets the Junk-Flag, when it looks like:
require ["imap4flags", "vnd.dovecot.pipe", "copy",
"imapsieve",
"environment", "variables"];
if environment :matches "imap.email" "*" {
? set "email" "${1}";??
}
addflag "Junk \\seen";
pipe :copy "learn-spam.sh";
pipe :copy "learn-spam-sa.sh" [ "${email}" ];
But the \\seen-Flag is not set.
When i comment out the addflag-line, the Junk-Flag is not set. So the
line works correct... but only for the Junk-Flag, not for the seen-Flag...
Why?
BR
Jakob
Am 04.12.18 um 12:46 schrieb Ralph Seichter:> * Jakobus Sch?rz:
>
>> addflag "Junk";
>> setflag "\\seen";
> That's probably not what you want, because the 'setflag'
command
> replaces all existing flags. In any case, I recommend you use this
> method instead:
>
> plugin {
> sieve_pipe_bin_dir = /etc/dovecot/sievepipe
>
> # Message moved into Spam folder
> imapsieve_mailbox1_name = Junk
> imapsieve_mailbox1_causes = COPY
> imapsieve_mailbox1_before = file:/etc/dovecot/sievepipe/report-spam
>
> # Message moved out of Spam folder
> imapsieve_mailbox2_name = *
> imapsieve_mailbox2_from = Junk
> imapsieve_mailbox2_causes = COPY
> imapsieve_mailbox2_before = file:/etc/dovecot/sievepipe/report-ham
> }
>
> This was typed from memory, so I hope the syntax is correct.
>
> -Ralph
Jakobus Schürz
2018-Dec-04 13:23 UTC
set seen flag and junk moving a mail manually to JUNK
Ok. I tried another Thunderbird-specific Flag:
require ["imap4flags", "vnd.dovecot.pipe", "copy",
"imapsieve", "environment", "variables"];
if environment :matches "imap.email" "*" {
? set "email" "${1}";??
}
addflag "Junk";
addflag "\\seen";
addflag "$label3";
pipe :copy "learn-spam.sh";
pipe :copy "learn-spam-sa.sh" [ "${email}" ];
When i move an unflagged email to Folder Junk, it is shown in
Thunderbird as "personal", Junk but Unseen.
So, the rule is really working, except for the \\seen-Flag.
I have the line
addflag "\\seen";
from the dovecot-wiki!
BG jakob
Am 04.12.18 um 14:06 schrieb Jakobus Sch?rz:> Hi Ralph!
>
> This is, what calls the correct sive-filter rules. I have that already
> in use.
> But the file
>
> file:/etc/dovecot/sievepipe/report-spam
>
> contains my sieve-script from my first posting.
> So, the difference from setflag to addflag is, setflag sets the flags,
> and only the given flags (removing all other flags), and addflag adds a
> flag to the existing flags...
>
> I fiddled around a little...
> The sieve-script sets the Junk-Flag, when it looks like:
>
> require ["imap4flags", "vnd.dovecot.pipe",
"copy", "imapsieve",
> "environment", "variables"];
>
> if environment :matches "imap.email" "*" {
> ? set "email" "${1}";??
> }
>
> addflag "Junk \\seen";
> pipe :copy "learn-spam.sh";
> pipe :copy "learn-spam-sa.sh" [ "${email}" ];
>
> But the \\seen-Flag is not set.
>
> When i comment out the addflag-line, the Junk-Flag is not set. So the
> line works correct... but only for the Junk-Flag, not for the seen-Flag...
> Why?
>
>
> BR
>
> Jakob
>
> Am 04.12.18 um 12:46 schrieb Ralph Seichter:
>> * Jakobus Sch?rz:
>>
>>> addflag "Junk";
>>> setflag "\\seen";
>> That's probably not what you want, because the 'setflag'
command
>> replaces all existing flags. In any case, I recommend you use this
>> method instead:
>>
>> plugin {
>> sieve_pipe_bin_dir = /etc/dovecot/sievepipe
>>
>> # Message moved into Spam folder
>> imapsieve_mailbox1_name = Junk
>> imapsieve_mailbox1_causes = COPY
>> imapsieve_mailbox1_before = file:/etc/dovecot/sievepipe/report-spam
>>
>> # Message moved out of Spam folder
>> imapsieve_mailbox2_name = *
>> imapsieve_mailbox2_from = Junk
>> imapsieve_mailbox2_causes = COPY
>> imapsieve_mailbox2_before = file:/etc/dovecot/sievepipe/report-ham
>> }
>>
>> This was typed from memory, so I hope the syntax is correct.
>>
>> -Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://dovecot.org/pipermail/dovecot/attachments/20181204/ac316940/attachment.html>
Now i tried an additional rule in my "normal" working sieve-filter:
if address :domain :matches "from" "company.example"
? { setflag "\\seen"; fileinto :create "INBOX/foo/test";
stop; }
and sent an email from my company-account. The folder INBOX/foo/test
gets created, but the message inside is not marked as seen.
So i think, this is a bug in dovecot/pigeonhole, which ignores the
\\seen-Flag being set by sieve-script.
I tried to set the seen-flag to the message with doveadm. This works
correctly.
BG Jakob
Am 04.12.18 um 14:23 schrieb Jakobus Sch?rz:>
> Ok. I tried another Thunderbird-specific Flag:
>
> require ["imap4flags", "vnd.dovecot.pipe",
"copy", "imapsieve", "environment",
"variables"];
> if environment :matches "imap.email" "*" {
> ? set "email" "${1}";??
> }
> addflag "Junk";
> addflag "\\seen";
> addflag "$label3";
> pipe :copy "learn-spam.sh";
> pipe :copy "learn-spam-sa.sh" [ "${email}" ];
>
> When i move an unflagged email to Folder Junk, it is shown in
> Thunderbird as "personal", Junk but Unseen.
>
> So, the rule is really working, except for the \\seen-Flag.
>
> I have the line
>
> addflag "\\seen";
>
> from the dovecot-wiki!
>
> BG jakob
>
>
>
> Am 04.12.18 um 14:06 schrieb Jakobus Sch?rz:
>> Hi Ralph!
>>
>> This is, what calls the correct sive-filter rules. I have that already
>> in use.
>> But the file
>>
>> file:/etc/dovecot/sievepipe/report-spam
>>
>> contains my sieve-script from my first posting.
>> So, the difference from setflag to addflag is, setflag sets the flags,
>> and only the given flags (removing all other flags), and addflag adds a
>> flag to the existing flags...
>>
>> I fiddled around a little...
>> The sieve-script sets the Junk-Flag, when it looks like:
>>
>> require ["imap4flags", "vnd.dovecot.pipe",
"copy", "imapsieve",
>> "environment", "variables"];
>>
>> if environment :matches "imap.email" "*" {
>> ? set "email" "${1}";??
>> }
>>
>> addflag "Junk \\seen";
>> pipe :copy "learn-spam.sh";
>> pipe :copy "learn-spam-sa.sh" [ "${email}" ];
>>
>> But the \\seen-Flag is not set.
>>
>> When i comment out the addflag-line, the Junk-Flag is not set. So the
>> line works correct... but only for the Junk-Flag, not for the
seen-Flag...
>> Why?
>>
>>
>> BR
>>
>> Jakob
>>
>> Am 04.12.18 um 12:46 schrieb Ralph Seichter:
>>> * Jakobus Sch?rz:
>>>
>>>> addflag "Junk";
>>>> setflag "\\seen";
>>> That's probably not what you want, because the
'setflag' command
>>> replaces all existing flags. In any case, I recommend you use this
>>> method instead:
>>>
>>> plugin {
>>> sieve_pipe_bin_dir = /etc/dovecot/sievepipe
>>>
>>> # Message moved into Spam folder
>>> imapsieve_mailbox1_name = Junk
>>> imapsieve_mailbox1_causes = COPY
>>> imapsieve_mailbox1_before =
file:/etc/dovecot/sievepipe/report-spam
>>>
>>> # Message moved out of Spam folder
>>> imapsieve_mailbox2_name = *
>>> imapsieve_mailbox2_from = Junk
>>> imapsieve_mailbox2_causes = COPY
>>> imapsieve_mailbox2_before =
file:/etc/dovecot/sievepipe/report-ham
>>> }
>>>
>>> This was typed from memory, so I hope the syntax is correct.
>>>
>>> -Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://dovecot.org/pipermail/dovecot/attachments/20181204/eb9ae09e/attachment-0001.html>