Sieve filter not working

Leniusz

New member
Joined
Apr 17, 2019
Messages
5
Hello,
I created simple filter on Dovecot sieve, file "default.sieve"
Code:
if header :contains "subject" "VIRUS"
{
discard;
stop;
}
Unfortunately filter not working, mails with subject contain VIRUS wont be discard. Any ideas?

dovecot-sieve.log and dovecot-sieve-errors.log are empty
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,902
Location
GMT +7.00
Hello,

I assume you're 100% sure your filter is written correct and does not contain syntax and/or logic errors.

There are two possible cases why it does not work:

1. system email accounts, which exist by default are not processed with Sieve filtering, i.e. emails to user@server.domain.com are not filtered.

where

- user - a login to Directadmin/FTP
- server.domains.com - hostname

2. emails have encoded subjects and email bodies, e.g. with the help of base64.

There might other cases exist, not too sure about them yet.
 

Leniusz

New member
Joined
Apr 17, 2019
Messages
5
Unfortunately none of these options looks correct to me.


I'm sure in 99% of my filter - code looks simply. Each message which subject contain to the string "VIRUS" should be discard - i'm right?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,902
Location
GMT +7.00
I don't validate your code, that's up to you.

Show RFC-headers of an email which was not filtered unlike you expected it.
 

Leniusz

New member
Joined
Apr 17, 2019
Messages
5
A part of email header:

MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_8c8756d04aebf8880641c946c4b81f84"
Date: Mon, 22 Apr 2019 23:10:52 +0100
From: "** *** ***." <***@***.com>
To: undisclosefd-recipients:;
Subject: *** VIRUS ***Invitation to Bid for Materials (NEW ORDER11)
Reply-To: ** *** *** <***@***.com>
Mail-Reply-To: ** *** *** <***@***.com>
Message-ID: <48157956eefa61edffe642ddb5cbaa46@**.com>
X-Sender: ***@***.com
Unfortunately ClamAV can only tag email as VIRUS, so I need a filter that each message with "VIRUS" string in subject will be discard.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,902
Location
GMT +7.00
To test your rules send from a remote email account an email with a word VIRUS in its subject and see results.
 

Leniusz

New member
Joined
Apr 17, 2019
Messages
5
Unfortunately not working. Default DirectAdmin dovecot installation and config works with sieve ?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,902
Location
GMT +7.00
Make sure to have pigeonhole=yes:

Code:
# grep pigeonhole= /usr/local/directadmin/custombuild/options.conf
pigeonhole=yes
Dovecot should be re-installed if you have pigeonhole=no after you change it to yes.

I'm filtering a lot of incoming emails with sieve depending on a subject of an email, and move emails to special folders.
 

Leniusz

New member
Joined
Apr 17, 2019
Messages
5
My custombuild options.conf:

Code:
pigeonhole=yes
I have no idea what's wrong.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,902
Location
GMT +7.00
1. Rebuild dovecot, roundcube

2. Use Roundcube interface to create a filter for once email account

3. Test for one email account
 
Top