I have another problem with mailfilter (the first one is solved here:
https://forum.zentyal.org/index.php/topic,34966.0.html). The problem is emails are somtimes moved to Spam folder even though they are Passed Clean in logs and have X-Spam-Flag set to NO.
First message: Passed Clean, X-Spam-Flag set to NO, moved to INBOX - So this one is ok.
logs:
May 14 10:24:01 zmail postfix/qmgr[10530]: 5070CA40943: from=<test@test.pl>, size=2172, nrcpt=1 (queue active)
May 14 10:24:01 zmail postfix/smtpd[14248]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
May 14 10:24:01 zmail amavis[13255]: (13255-07) iAvEEAWRv222 FWD from <test@test.pl> -> <adam@company.pl>, BODY=8BITMIME 250 2.0.0 from MTA(smtp:[127.0.0.1]10025): 250 2.0.0 Ok: queued as 5070CA40943
May 14 10:24:01 zmail amavis[13255]: (13255-07) Passed CLEAN, [127.0.0.1] <test@test.pl> -> <adam@company.pl>, Message-ID: <da64031eafbfc5a33d8dab599030af0d@test.pl>, Hits: -
May 14 10:24:01 zmail postfix/smtp[14246]: 67B6FA4085C: to=<adam@company.pl>, orig_to=<adam@company-internal.pl>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.4 delays=0.86/0.01/0/0.51, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 5070CA40943)
May 14 10:24:01 zmail postfix/qmgr[10530]: 67B6FA4085C: removed
May 14 10:24:01 zmail dovecot: lda(adam@company.pl): sieve: msgid=<da64031eafbfc5a33d8dab599030af0d@test.pl>: stored mail into mailbox 'INBOX'
mail header:
Return-Path: <test@test.pl>
Delivered-To: adam@company.pl
Received: from localhost (localhost [127.0.0.1])
by zmail.company-internal.pl (Postfix) with ESMTP id 5070CA40943
for <adam@company.pl>; Thu, 14 May 2020 10:24:00 +0200 (CEST)
X-Virus-Scanned: by amavisd-new-2.11.0 (20160426) (Debian) at
company-internal.pl
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level:
X-Spam-Status: No, score=x required=5 WHITELISTED tests=[]
autolearn=unavailable
Second message: Passed Clean, X-Spam-Flag set to NO, moved to Spam -
here is the problem.
logs:
May 14 15:16:06 zmail postfix/qmgr[10530]: C4324A408C7: from=<test@test.pl>, size=1837, nrcpt=1 (queue active)
May 14 15:16:06 zmail amavis[18333]: (18333-06) K4p7hs-10GS4 FWD from <test@test.pl> -> <tom@company.pl>, BODY=8BITMIME 250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as C4324A408C7
May 14 15:16:06 zmail amavis[18333]: (18333-06) Passed CLEAN, [127.0.0.1] <test@test.pl> -> <tom@company.pl>, Message-ID: <1721353d280.2823.c4fc9197a5f3f99540422edde7fae6e2@test.pl>, Hits: -
May 14 15:16:06 zmail postfix/smtp[17777]: AE05DA405D9: to=<tom@company.pl>, orig_to=<tom@company-internal.pl>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.12, delays=0.03/0/0/0.09, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as C4324A408C7)
May 14 15:16:06 zmail postfix/qmgr[10530]: AE05DA405D9: removed
May 14 15:16:06 zmail dovecot: lda(tom@company.pl): sieve: msgid=<1721353d280.2823.c4fc9197a5f3f99540422edde7fae6e2@test.pl>: stored mail into mailbox 'Spam'
header:
Return-Path: <test@test.pl>
Delivered-To: tom@company.pl
Received: from localhost (localhost [127.0.0.1])
by zmail.company-internal.pl (Postfix) with ESMTP id C4324A408C7
for <tom@company.pl>; Thu, 14 May 2020 15:16:06 +0200 (CEST)
X-Virus-Scanned: by amavisd-new-2.11.0 (20160426) (Debian) at
company-internal.pl
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level:
X-Spam-Status: No, score=x required=5 WHITELISTED tests=[]
autolearn=unavailable
/var/vmail/default.sieve
cat default.sieve
require ["fileinto"];
# rule:[SPAM]
if header :contains "X-Spam-Flag" "YES" {
fileinto "Spam";
}
if header :contains "subject" ["***UNCHECKED***", "SPAM"] {
fileinto "Spam";
}