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
On 13 May 2020, at 12:10, Peter Folta <mail at peterfolta.net> wrote:> 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?My impression was that without a keep (impact or explicit) or fileinto, sieve modifications to the message are not written, but I can?t find anything to confirm that. -- The person on the other side was a young woman. Very obviously a young woman. There was no possible way that she could have been mistaken for a young man in any language, especially Braille.
> 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 > PeterTry 'sieve-test' utility to see what it is doing. Aki
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
Op 13-5-2020 om 20:10 schreef Peter Folta:> 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 > }What version is this? Please provide output of `dovecot -n`. This smells a lot like an age-old bug that was fixed long ago. It works fine with master. Regards, Stephan.
Hi Stephan, Sorry for the delay - this was on version 2.3.4.1 (f79e8e7e4). Relevant bits from the config: # 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.4 () # OS: Linux 4.19.0-9-amd64 x86_64 Debian 10.4 managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext editheader imapsieve vnd.dovecot.imapsieve sieve_extensions = +editheader sieve_global_extensions = +vnd.dovecot.pipe sieve_pipe_bin_dir = /usr/bin sieve_plugins = sieve_imapsieve sieve_extprograms Thanks Peter> On May 15, 2020, at 3:49 PM, Stephan Bosch <stephan at rename-it.nl> wrote: > > > > Op 13-5-2020 om 20:10 schreef Peter Folta: >> 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 >> } > > What version is this? Please provide output of `dovecot -n`. > > This smells a lot like an age-old bug that was fixed long ago. > > It works fine with master. > > Regards, > > Stephan.
Seemingly Similar Threads
- Sieve addheader directive works only partially
- Sieve addheader directive works only partially
- Sieve addheader directive works only partially
- sieve /editheader / addheader :last crash
- When the subject portion of an e-mail contains a control character, dovecot.sieve terminates unexpectatedly.