my local.conf has:
# 90-sieve.conf
plugin {
sieve_before = /home/sieve/globalfilter.sieve
}
and cat /home/sieve/globalfilter.sieve
require ["fileinto","mailbox"];
if anyof
(
header :contains "X-Spam-Flag" "YES",
header :contains "subject" "***SPAM***"
)
{
fileinto :create "Spam";
}
There IS a globalfilter.svbin
when I tried:
sendmail -i testit3 at test.htt-consult.com < sample-spam-GTUBE-junk.txt
amavis is flagging it as ***Spam***
but it stays in inbox. So I tried:
sieve-test -e -l /home/vmail/test.htt-consult.com/testit3/
/home/sieve/globalfilter.sieve
/home/vmail/test.htt-consult.com/testit3/cur/1491512409.M371278P6513.z9m9z.test.htt-consult.com\,S\=1823\,W\=1868\:2\,
info: msgid=<GTUBE1.1010101 at example.net>: stored mail into mailbox
'Spam'.
sieve-test(root): Info: final result: success
And it DID get copied to Spam, not moved. I am now seeing it in inbox
and Spam. Of course ownership on the message in Spam were wrong
(root:root instead of vmail:mail, but I fixed that).
So two questions, probably linked:
Why did sieve not work. Is the subject test case sensitive?
If it is case sensitive, why did the sieve-test work?
thanks
Hello Robert, You said that the script worked when you ran it with sieve-test, proabably as root user, but not when you sent an e-mail with sendmail, which I guess would run it as the dovecot user (probably vmail as you said you changed the ownership of the e-mail to vmail:mail ?) You forgot to show us the file permissions on the script and the folder containing it. A namei -l on the whole path can show if dovecot can reach it. Example : root at messagerie-secours[10.10.10.20] ~ # namei -l /var/vmail/mailfilters/spam.svbin f: /var/vmail/mailfilters/spam.svbin drwxr-xr-x root root / drwxr-xr-x root root var drwxr-xr-x vmail vmail vmail drwxr-xr-x root root mailfilters -rw-r--r-- vmail vmail spam.svbin root at messagerie-secours[10.10.10.20] ~ # -- Yassine.
Yassine, I believe I sent a 'solved' message. It was a permission problem in that .svbin was owned by root. I have my commands in the wrong order in my script. Robert On 04/09/2017 06:34 AM, chaouche yacine wrote:> Hello Robert, > > You said that the script worked when you ran it with sieve-test, proabably as root user, but not when you sent an e-mail with sendmail, which I guess would run it as the dovecot user (probably vmail as you said you changed the ownership of the e-mail to vmail:mail ?) > > > You forgot to show us the file permissions on the script and the folder containing it. A namei -l on the whole path can show if dovecot can reach it. > > Example : > > > root at messagerie-secours[10.10.10.20] ~ # namei -l /var/vmail/mailfilters/spam.svbin > f: /var/vmail/mailfilters/spam.svbin > drwxr-xr-x root root / > drwxr-xr-x root root var > drwxr-xr-x vmail vmail vmail > drwxr-xr-x root root mailfilters > -rw-r--r-- vmail vmail spam.svbin > root at messagerie-secours[10.10.10.20] ~ # > > > > > -- Yassine. >