Once upon a time, Chris Adams cma@cmadams.net said:
I can confirm that a message with multiple Subject: and multiple From: headers does not get filed correctly into the Spam folder. The sieve-test tools shows the correct action, but when the message comes in via LMTP, it goes into INBOX.
Okay, digging some more, it looks like something in sieve is overwriting the wrong thing when it gets messages with some headers (at least From: and Subject:) repeated. I enabled the vnd.dovecot.debug sieve plugin, and used this sieve script:
require [ "fileinto", "variables", "vnd.dovecot.debug" ];
if header :matches "from" "*" { set "from" "${1}"; }
if header :matches "subject" "*" { set "subject" "${1}"; }
if header :matches "x-spam-flag" "*" { set "spam" "${1}"; }
debug_log "From='${from}' Subject='${subject}' Spam='${spam}'";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Spam";
}
When I feed a message to dovecot-lda with single From: and Subject: headers and X-Spam-Flag: YES set, I get this logged:
May 19 14:25:25 hosting dovecot: lda(local@example.com): sieve: default: line 6: DEBUG: From='test@cmadams.net' Subject='Test' Spam='YES'
If I duplicate the From: and Subject: headers, I get:
May 19 14:25:29 hosting dovecot: lda(local@example.com): sieve: default: line 6: DEBUG: From='test@cmadams.net' Subject='Test' Spam='local@example.com'
So, X-Spam-Flag: is somehow getting the To: address in it?
Oddly, with this debugging enabled, even though the message with the duplicate headers appears to have the wrong value for X-Spam-Flag:, it then procedes to actually match the YES somehow and file the message in the Spam folder.
-- Chris Adams cma@cmadams.net