Sieve addheader directive works only partially

Peter Folta mail at peterfolta.net
Thu May 14 22:45:01 EEST 2020


Thanks both for the useful pointers.

Adding an explicit keep does indeed set the header. I’m confused why it makes a difference though since the default implicit action is keep. I’m also surprised this is necessary given that the setflag directive of the imap4flags extension does not require an explicit keep. I can’t find anything in the Pigeonhole documentation or the edit headers RFC about requiring an explicit keep either.

Thanks for pointing out sieve-test, however, it doesn’t help clear up my confusion as it doesn’t mention the addheader directive at all:

sieve-test without explicit keep:

Performed actions:

  (none)

Implicit keep:

 * store message in folder: INBOX

sieve-test(root): Info: final result: success

sieve-test with explicit keep:

Performed actions:

 * store message in folder: INBOX

Implicit keep:

  (none)

In any case, adding keep has fixed my problem though - so thanks for the suggestion!

Peter

> On May 14, 2020, at 7:08 AM, Aki Tuomi <aki.tuomi at open-xchange.com> wrote:
> 
> 
>> On 13/05/2020 21:10 Peter Folta <mail at peterfolta.net> wrote:
>> 
>> 
>> Hi all,
>> 
>> I want to add a custom header to incoming emails from a particular sender. This is what my user Sieve script looks like:
>> 
>> require “editheader”;
>> 
>> if address :is "From” “special-sender at example.com” {
>>    addheader “X-My-Custom-Header” “Header Value";
>> }
>> 
>> I have enabled the editheader extension in my Dovecot configuration:
>> 
>> plugin {
>>>>    sieve_extensions = +editheader
>> }
>> 
>> This doesn’t seem to work and no header is added to the email.
>> However, if I also move the email to a different folder in the same if-block, the header gets added just fine:
>> 
>> require “editheader”;
>> require “fileinto”;
>> 
>> if address :is "From” “special-sender at example.com” {
>>    addheader “X-My-Custom-Header” “Header Value”;
>>    fileinto “MyFolder”;
>> }
>> 
>> Am I missing something?
>> 
>> Thanks
>> Peter
> 
> Try 'sieve-test' utility to see what it is doing.
> 
> Aki



More information about the dovecot mailing list