Once upon a time, Stephan Bosch <stephan at rename-it.nl> said:> On 5/15/2015 5:56 PM, Chris Adams wrote: > > Once upon a time, Stephan Bosch <stephan at rename-it.nl> said: > >> You can check the handling of a particular message yourself using the > >> sieve-test tool (there is a man page for it). By specifying the `-t - > >> -Tlevel=matching` options, you'll get detailed information on why a > >> particular decision is made. > > Hmm, that's weird. sieve-test says it would store the message into the > > Spam folder (as expected), but it was definitely delivered to INBOX. > > BTW, did you consult your logs for any errors? If an error occurs during > Sieve processing, the default behavior is to file the message into INBOX > (e.g. when the Spam folder doesn't exist).Yes, I didn't find any errors, just the lmtp log entry for storing into INBOX. In the several cases I looked at, the Spam folder exists, is getting most spam-flagged messages filed into it, it just seems to be something about some messages (for example, got a bunch of copies of this particular spam to different users and they all went to INBOX instead of Spam). May 15 09:44:04 dovecot2 dovecot: lmtp(10157): Connect from 10.0.9.71 May 15 09:44:05 dovecot2 dovecot: lmtp(10157, localuser9 at foothills.net): MikHD8/YVVWtJwAAIYJ+iw: sieve: msgid=<438088200.476329351.0075518260474.JavaMail.root at sjmas02.lococandles.co>: stored mail into mailbox 'INBOX' May 15 09:44:05 dovecot2 dovecot: lmtp(10157): Disconnect from 10.0.9.57: Successful quit Also, if the Spam folder didn't exist, I have it set to be autocreated in the Dovecot config. I also know that Dovecot can write to the Spam folder okay, because I did a "doveadm move" to move several "X-Spam-Flag: YES" messages to the Spam folder, and that worked. -- Chris Adams <cma at cmadams.net>
Once upon a time, Chris Adams <cma at cmadams.net> said:> In the several cases I looked at, the Spam folder exists, is > getting most spam-flagged messages filed into it, it just seems to be > something about some messages (for example, got a bunch of copies of > this particular spam to different users and they all went to INBOX > instead of Spam).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. -- Chris Adams <cma at cmadams.net>
Once upon a time, Chris Adams <cma at 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 at example.com): sieve: default: line 6: DEBUG: From='test at 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 at example.com): sieve: default: line 6: DEBUG: From='test at cmadams.net' Subject='Test' Spam='local at 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 at cmadams.net>