[Dovecot] Move messages marked as Spam
Hello
I have implemented recently in my work bogofilter to mark messages as Spam or Ham, currently is working perfectly, but I want to move those messages marked as spam to a folder called spam.
I installed dovecot-sieve with the intention of using fileinto to accomplish this.
my question is: where I put this:
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; }
so that all messages that come to my users go into the spam folder?
and how i handle messages that are marked as "Unsure"
X-Bogosity: Unsure
Thanks Michel
Webmail, servicio de correo electronico Casa de las Americas - La Habana, Cuba.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 6 Oct 2009, michel@casa.co.cu wrote:
my question is: where I put this:
It depends on your Sieve version:
cmusieve needs the script in <user-home>/.dovecot.sieve or you configure one script for all users.
libsieve uses <user-home>/.dovecot.sieve, too, and you can configure pre- and post- sieve scripts.
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam";
add
stop;
here
}
so that all messages that come to my users go into the spam folder?
and how i handle messages that are marked as "Unsure"
X-Bogosity: Unsure
Well, the same? File it into SPAM_Unsure?
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBSsyGt3WSIuGy1ktrAQJ5zAf+Is62bD203w5JqfL5nfryBVZKxRQ7vfGM 6qmjonib1dUHUfGpfP6zAb5ZNoTTQSQVZGVqLkrBz3+Us8gD4ECm7UlZHZHi1S6G f1qZw8NO/uM+RuJ22STSU8cUlu+a8lE9d7/le/2PBFZjXOMoVG9hLVsxBmdi2QfC A52Y4llvIz59PMCJHbW0u7KvpmsghMHe15FAhxZSb243sCDVX6hTE8ngbePSddNf O3Rsx8BxKwbEvwnBGyBIewB5SvdlbJAvo4gGOm/VH5Ftd0zP9CHulkKUffjNdy/4 itF9KqteUJJSMWU7CuqYQcL2LIwu8DQCfyhr4RiyVPkFY/MPMKVvjw== =iQBp -----END PGP SIGNATURE-----
On Wed, 2009-10-07 at 14:16 +0200, Steffen Kaiser wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 6 Oct 2009, michel@casa.co.cu wrote:
my question is: where I put this:
It depends on your Sieve version:
cmusieve needs the script in <user-home>/.dovecot.sieve or you configure one script for all users.
libsieve uses <user-home>/.dovecot.sieve, too, and you can configure pre- and post- sieve scripts.
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam";
add
stop;
here
}
so that all messages that come to my users go into the spam folder?
and how i handle messages that are marked as "Unsure"
X-Bogosity: Unsure
Well, the same? File it into SPAM_Unsure?
Bye,
I use dovecot-1.1.18 for which I am using dovecot-sieve-1.1.7
I would define a single script for all my users, according to documentation is declared using the variable sieve_global_path = /etc/dovecot.sieve
my script:
require "fileinto";
if header: contains "X-Bogosity" "spam" ( fileinto "Spam"; stop; )
my config:
mail_plugins = cmusieve quota sieve_global_path = /etc/dovecot.sieve
saving changes, the saved messages as spam not moved to the spam folder.
when I check in the logs I see this message: Per-user script path is unknown. See http://wiki.dovecot.org/LDA/Sieve # location
defining the same path as the previous script in the plugin section, all incoming messages for spam moves, all marked as spam and ham.
Plugin {
sieve = /etc/dovecot.sieve
}
mx1 deliver (michel@casa.co.cu): msgid = <1254916568.4acc81d82712a @ home.com>: saved mail to spam
a question, after the script run for each incoming message, once the filter matches any message marked as spam, the script create the folder in the mailbox of my users and or i have create manually?
thanks
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 7 Oct 2009, Michel Bulgado wrote:
a question, after the script run for each incoming message, once the filter matches any message marked as spam, the script create the folder in the mailbox of my users and or i have create manually?
There is an option of deliver to control this -n: http://wiki.dovecot.org/LDA
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBSsyZ2XWSIuGy1ktrAQKE0wgAs1FtReCy6xfYGmn6scAmsFIN3EHE48ke qVV8fARUhEu4AUxJpnH9LWfnBztRQwZ1JfK99WE9OkLwedebf5BR6BZvKbrhyzET 6BQBBx5DP2LxOnqjDXwpufvysYicKQKDXkq8s+RRDXiaaSHkYlMDkuzagctpibpl MM1YC2zjhh/OWG3yfCRgf9oKLd6c1Pfueb0lqetoGAYiDbAl7IfA63kZyv/hM+S5 p0Hc4Tiqiw1Wtlt/qM7y+kEO5By6+6JwWE5RDhKgk13R8hE8FDfjkRMP0VOS9kYP VdehszPJjcbdbvQQny2yN4Pt1Vv/QQrlOmSQU4zJ66Kkbsvybrywtg== =Ug5n -----END PGP SIGNATURE-----
Steffen Kaiser skdovecot@smail.inf.fh-brs.de escribió:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 7 Oct 2009, Michel Bulgado wrote:
a question, after the script run for each incoming message, once the filter matches any message marked as spam, the script create the folder in the mailbox of my users and or i have create manually?
There is an option of deliver to control this -n: http://wiki.dovecot.org/LDA
Bye,
no desire to control or limit the script
wondered whether the script to run and find some header message marked
as spam, is able to create for itself a folder called spam so to move
the message to her.
Webmail, servicio de correo electronico Casa de las Americas - La Habana, Cuba.
Am 07.10.2009 um 18:29 schrieb michel@casa.co.cu:
There is an option of deliver to control this -n: http://wiki.dovecot.org/LDA
Bye,
no desire to control or limit the script
wondered whether the script to run and find some header message
marked as spam, is able to create for itself a folder called spam so
to move the message to her.
That's what the option -n is for, as Steffen stated...
On Wed, 2009-10-07 at 18:39 +0200, Thomas Leuxner wrote:
Am 07.10.2009 um 18:29 schrieb michel@casa.co.cu:
There is an option of deliver to control this -n: http://wiki.dovecot.org/LDA
Bye,
no desire to control or limit the script
wondered whether the script to run and find some header message
marked as spam, is able to create for itself a folder called spam so
to move the message to her.That's what the option -n is for, as Steffen stated...
I made some corrections to my script, with the intention of moving those messages marked as spam into a folder called spam.
continue to enter the inbox folder but not move.
this is my dovecot config:
# 1.1.18: /etc/dovecot.conf # OS: Linux 2.6.18-164.el5 x86_64 CentOS release 5.3 (Final) ext3 listen: * login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login mail_uid: 501 mail_gid: 501 mail_location: maildir:/var/spool/virtualmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 lda: postmaster_address: postmaster@home.com mail_plugins: cmusieve quota auth default: passdb: driver: ldap args: /etc/dovecot-ldap.conf userdb: driver: prefetch userdb: driver: ldap args: /etc/dovecot-ldap-userdb.conf socket: type: listen master: path: /var/run/dovecot/auth-master mode: 384 user: vmail plugin: quota_warning: storage=95%% /usr/local/bin/quota-warning.sh 95 quota: maildir quota_rule: *:storage=40M sieve_global_path: /etc/dovecot/sieve sieve_global_dir: /etc/dovecot/sieve/global-default.script
global-default.script #####################
require ["include"]; include :global "global-spam.script";
global-spam.script ###################
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
Message header: ################ X-Bogosity: Spam, tests=bogofilter, spamicity=1.000000, version=1.2.1
Postfix - Master.cf ###################
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient} -n
And i still seeing this in my logs: mailserver deliver(michel@casa.co.cu): Per-user script path is unknown. See http://wiki.dovecot.org/LDA/Sieve#location
there may be something that is not seeing or ignoring me this
Greetings Michel
Am 07.10.2009 um 21:10 schrieb Michel Bulgado:
global-default.script #####################
require ["include"]; include :global "global-spam.script";
global-spam.script ###################
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
The include is intended to be run from a personal script. You kind of
loop it from the global script itself.
And i still seeing this in my logs: mailserver deliver(michel@casa.co.cu): Per-user script path is
unknown. See http://wiki.dovecot.org/LDA/Sieve#location
Per default 'cmusieve' will look for '.dovecot.sieve' in the user's
home directory. Reference your global script from there, or better,
for testing put the code of the global script in '.dovecot.sieve'.
You may also configure the personal script:
sieve = /var/sieve-scripts/%u.sieve
Regards Thomas
Thomas Leuxner tlx@leuxner.net escribió:
Am 07.10.2009 um 21:10 schrieb Michel Bulgado:
global-default.script #####################
require ["include"]; include :global "global-spam.script";
global-spam.script ###################
require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
The include is intended to be run from a personal script. You kind
of loop it from the global script itself.And i still seeing this in my logs: mailserver deliver(michel@casa.co.cu): Per-user script path is unknown. See http://wiki.dovecot.org/LDA/Sieve#location
Per default 'cmusieve' will look for '.dovecot.sieve' in the user's
home directory. Reference your global script from there, or better,
for testing put the code of the global script in '.dovecot.sieve'.You may also configure the personal script:
sieve = /var/sieve-scripts/%u.sieve
Regards Thomas
I create another script just place, only to the user and still pass
the same when you define the user a personal script, it happens that
for every message that comes is moved into spam and I mean all
messages marked as either spam or ham.
Plugin section ################# sieve = /var/sieve-scripts/%u.sieve
file ########## /var/sieve-scripts/michel.sieve
michel.sieve ############ require "fileinto";
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
server log
################
mailserver deliver(michel@casa.co.cu):
msgid=1255000600.4acdca18a3940@webmail.sld.cu: saved mail to Spam
I dont know why move all messages , when in the script is only for
messages marked as "Spam".
I checked the message headers are right
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.1
Webmail, servicio de correo electronico Casa de las Americas - La Habana, Cuba.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 8 Oct 2009, michel@casa.co.cu wrote:
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
server log ################ mailserver deliver(michel@casa.co.cu): msgid=1255000600.4acdca18a3940@webmail.sld.cu: saved mail to Spam
I dont know why move all messages , when in the script is only for messages marked as "Spam".
I checked the message headers are right
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.1 ^^^^^
There is the word "Spam" you search for.
Look at RFC 3028 sec. 2.7.3, I think you need
if header :contains :comparator "i;octet"
to have a case-sensitive match.
I thought there is a ":begin" match type, but the RFC does not list it.
Or use
if header :contains "X-Bogosity" "Spam, " {
Note the ", " .
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBSs3fJ3WSIuGy1ktrAQJWqwgAgtVXTFfn4ccrLpsoPz1oBpMsxnw6QW7p L4Td3B6qdT/ufFk0vPlcogs288MbFocQkcGJq0yrX2uiAGghjeE039J3BUO84YDx AtzEQJPj/3RVPr34zBM+BlOPhHC9pQS+T06cegCgoWZlLFkh3A7Mh5ViedisX3HU B/E/bSEPWRg5KMyo0ykum6tFlXOXl1N/uRodwFbbugwWg9309pJEyL/MYxAcRllm HKTNj1ixP9tlZesPgupExiJeBsR9hC9/Pho8Q7G3ctl/8Th2J5CGxS+vucnQWZaH FXFeeDogjLcvbpvDSIecZeTeEt+lwuHa1vnMJWM7JVuSFi2/9xurlQ== =CToH -----END PGP SIGNATURE-----
On Thu, 2009-10-08 at 14:46 +0200, Steffen Kaiser wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 8 Oct 2009, michel@casa.co.cu wrote:
if header :contains "X-Bogosity" "Spam" { fileinto "Spam"; stop; }
server log ################ mailserver deliver(michel@casa.co.cu): msgid=1255000600.4acdca18a3940@webmail.sld.cu: saved mail to Spam
I dont know why move all messages , when in the script is only for messages marked as "Spam".
I checked the message headers are right
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.1 ^^^^^
There is the word "Spam" you search for.
Look at RFC 3028 sec. 2.7.3, I think you need
if header :contains :comparator "i;octet"
to have a case-sensitive match.
I thought there is a ":begin" match type, but the RFC does not list it.
Or use
if header :contains "X-Bogosity" "Spam, " {
Note the ", " .
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE-----
the problem was in the script.
All messages were moved to the Spam folder because spamicity word.
Thanks
participants (5)
-
Charles Marcus
-
Michel Bulgado
-
michel@casa.co.cu
-
Steffen Kaiser
-
Thomas Leuxner