sieve filter bevor.spam, arnt take effect
Hello
Please willing to filter "bevor spam" mail...
filtering arnt take effect .. please i dont see the mistake.
Thanks for any possible update.
Debian buster
--
root@nmail:/etc/dovecot# dpkg -l | grep dovecot
dovecot-core 1:2.3.4.1-5+deb10u6
dovecot-imapd 1:2.3.4.1-5+deb10u6
dovecot-lmtpd 1:2.3.4.1-5+deb10u6
dovecot-managesieved 1:2.3.4.1-5+deb10u6
dovecot-mysql 1:2.3.4.1-5+deb10u6
dovecot-sieve 1:2.3.4.1-5+deb10u6
root@nmail:/etc/dovecot/sieve# cat before.sieve
# Sieve rules that are run before the user's filters.
# Messages flagged as spam are moved into the Junk folder.
require [ "fileinto", "mailbox" ];
if header :contains "X-Spam-Flag" "YES"
{
fileinto :create "INBOX.Junk";
stop;
}
--
already executed
# sieve before.sieve
--
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
}
--
root@nmail:/etc/dovecot/conf.d# mailto:root@nmail:/etc/dovecot/conf.d# cat 90-sieve.conf
##
## Settings for the Sieve interpreter
##
plugin {
# The path to the user's main active script. If ManageSieve is used, this the
# location of the symbolic link controlled by ManageSieve.
# sieve = ~/sieve/.dovecot.sieve
sieve = file:%h/sieve;active=%h/.dovecot.sieve
# Directory for :personal include scripts for the include extension. This
# is also where the ManageSieve service stores the user's scripts.
sieve_dir = ~/sieve
# Path to a script file or a directory containing script files that need to be
# executed before the user's script. If the path points to a directory, all
# the Sieve scripts contained therein (with the proper .sieve extension) are
# executed. The order of execution within a directory is determined by the
# file names, using a normal 8bit per-character comparison. Multiple script
# file or directory paths can be specified by appending an increasing number.
sieve_before = /etc/dovecot/sieve/before.sieve
}
--
root@nmail:/etc/dovecot# doveconf -n
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-16-amd64 x86_64 Debian 10.9
# Hostname: nmail.caloro.ch
auth_mechanisms = plain login
auth_verbose = yes
info_log_path = /var/log/mail.log
log_timestamp = %b %d %H:%M:%S Dovecot/
mail_access_groups = vmail
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
sieve = ~/sieve/.dovecot.sieve
sieve_dir = ~/sieve
}
postmaster_address = mca@caloro.ch mailto:mca@caloro.ch
protocols = imap lmtp sieve
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-client {
mode = 0660
user = mail
}
}
service imap-login {
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
ssl = yes
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service stats {
unix_listener stats-reader {
group = vmail
mode = 0666
user = vmail
}
unix_listener stats-writer {
group = vmail
mode = 0666
user = vmail
}
}
ssl = required
ssl_cert =
ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocol lda {
mail_plugins = " quota sieve"
}
protocol imap {
mail_plugins = " quota imap_quota"
ssl_cert =
ssl_key = # hidden, use -P to show it
}
protocol lmtp {
mail_plugins = " sieve"
}
Mauri
Hello, (Excuse me for top-posting, but the message below is too messy)
Your sieve config according to "dovecot -n" does not match what you have in 90-sieve.conf.
Have you deleted the line "!include conf.d/*.conf" in doveconf.conf?
Please double check that, as your config may not be what you'd expect it to be.. Cheers.
On Mon, 12 Apr 2021, Maurizio Caloro wrote:
Hello
Please willing to filter "bevor spam" mail...
filtering arnt take effect .. please i dont see the mistake.
Thanks for any possible update.
Debian buster
--
root@nmail:/etc/dovecot# dpkg -l | grep dovecot
dovecot-core 1:2.3.4.1-5+deb10u6
dovecot-imapd 1:2.3.4.1-5+deb10u6
dovecot-lmtpd 1:2.3.4.1-5+deb10u6
dovecot-managesieved 1:2.3.4.1-5+deb10u6
dovecot-mysql 1:2.3.4.1-5+deb10u6
dovecot-sieve 1:2.3.4.1-5+deb10u6
root@nmail:/etc/dovecot/sieve# cat before.sieve
# Sieve rules that are run before the user's filters.
# Messages flagged as spam are moved into the Junk folder.
require [ "fileinto", "mailbox" ];
if header :contains "X-Spam-Flag" "YES"
{
fileinto :create "INBOX.Junk";
stop;
}
--
already executed
# sieve before.sieve
--
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
}
--
root@nmail:/etc/dovecot/conf.d# mailto:root@nmail:/etc/dovecot/conf.d# cat 90-sieve.conf
##
## Settings for the Sieve interpreter
##
plugin {
# The path to the user's main active script. If ManageSieve is used, this the
# location of the symbolic link controlled by ManageSieve.
# sieve = ~/sieve/.dovecot.sieve
sieve = file:%h/sieve;active=%h/.dovecot.sieve
# Directory for :personal include scripts for the include extension. This
# is also where the ManageSieve service stores the user's scripts.
sieve_dir = ~/sieve
# Path to a script file or a directory containing script files that need to be
# executed before the user's script. If the path points to a directory, all
# the Sieve scripts contained therein (with the proper .sieve extension) are
# executed. The order of execution within a directory is determined by the
# file names, using a normal 8bit per-character comparison. Multiple script
# file or directory paths can be specified by appending an increasing number.
sieve_before = /etc/dovecot/sieve/before.sieve
}
--
root@nmail:/etc/dovecot# doveconf -n
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-16-amd64 x86_64 Debian 10.9
# Hostname: nmail.caloro.ch
auth_mechanisms = plain login
auth_verbose = yes
info_log_path = /var/log/mail.log
log_timestamp = %b %d %H:%M:%S Dovecot/
mail_access_groups = vmail
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
sieve = ~/sieve/.dovecot.sieve
sieve_dir = ~/sieve
}
postmaster_address = mca@caloro.ch mailto:mca@caloro.ch
protocols = imap lmtp sieve
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-client {
mode = 0660
user = mail
}
}
service imap-login {
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
ssl = yes
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service stats {
unix_listener stats-reader {
group = vmail
mode = 0666
user = vmail
}
unix_listener stats-writer {
group = vmail
mode = 0666
user = vmail
}
}
ssl = required
ssl_cert =
ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocol lda {
mail_plugins = " quota sieve"
}
protocol imap {
mail_plugins = " quota imap_quota"
ssl_cert =
ssl_key = # hidden, use -P to show it
}
protocol lmtp {
mail_plugins = " sieve"
}
Mauri
Thanks for your answer.... after remark this line restart the service and nothing changed...
oot@nmail:/etc/dovecot# cat dovecot.conf # 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.16 (fed8554) # OS: Linux 4.9.0-12-amd64 x86_64 Debian 9.12
# Enable installed protocols !include_try /usr/share/dovecot/protocols.d/*.protocol auth_mechanisms = plain login auth_verbose = yes disable_plaintext_auth = yes info_log_path = /var/log/mail.log log_timestamp = %b %d %H:%M:%S Dovecot/ mail_access_groups = vmail mail_location = maildir:~/Maildir managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
postmaster_address = mca@caloro.ch
protocols = imap lmtp sieve
service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-client { mode = 0660 user = mail } } service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } }
service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { mode = 0600 user = postfix group = postfix } }
ssl = required ssl_key =
ssl_dh=
ssl_min_protocol=TLSv1.2 ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
protocol imap { ssl_key =
service stats { unix_listener stats-reader { group = vmail mode = 0666 user = vmail } unix_listener stats-writer { group = vmail mode = 0666 user = vmail } }
## ## !include_try local.conf
-----Ursprüngliche Nachricht----- Von: dovecot dovecot-bounces@dovecot.org Im Auftrag von Bernardo Reino Gesendet: Montag, 12. April 2021 16:01 An: Dovecot Mailing List dovecot@dovecot.org Betreff: Re: sieve filter bevor.spam, arnt take effect
Hello, (Excuse me for top-posting, but the message below is too messy)
Your sieve config according to "dovecot -n" does not match what you have in 90-sieve.conf.
Have you deleted the line "!include conf.d/*.conf" in doveconf.conf?
Please double check that, as your config may not be what you'd expect it to be.. Cheers.
On Mon, 12 Apr 2021, Maurizio Caloro wrote:
Hello
Please willing to filter "bevor spam" mail... filtering arnt take effect .. please i dont see the mistake. Thanks for any possible update Debian buster
Hi again,
Your dovecot.conf neither contains the sieve settings nor includes the conf.d/90-sieve.conf file, which means that you only get whatever default config dovecot includes.
Good luck..
On Mon, 12 Apr 2021, Maurizio Caloro wrote:
Thanks for your answer.... after remark this line restart the service and nothing changed...
oot@nmail:/etc/dovecot# cat dovecot.conf # 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.16 (fed8554) # OS: Linux 4.9.0-12-amd64 x86_64 Debian 9.12
# Enable installed protocols !include_try /usr/share/dovecot/protocols.d/*.protocol auth_mechanisms = plain login auth_verbose = yes disable_plaintext_auth = yes info_log_path = /var/log/mail.log log_timestamp = %b %d %H:%M:%S Dovecot/ mail_access_groups = vmail mail_location = maildir:~/Maildir managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
postmaster_address = mca@caloro.ch
protocols = imap lmtp sieve
service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-client { mode = 0660 user = mail } } service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } }
service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { mode = 0600 user = postfix group = postfix } }
ssl = required ssl_key =
ssl_dh=
ssl_min_protocol=TLSv1.2 ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
protocol imap { ssl_key =
service stats { unix_listener stats-reader { group = vmail mode = 0666 user = vmail } unix_listener stats-writer { group = vmail mode = 0666 user = vmail } }
## ## !include_try local.conf
-----Ursprüngliche Nachricht----- Von: dovecot dovecot-bounces@dovecot.org Im Auftrag von Bernardo Reino Gesendet: Montag, 12. April 2021 16:01 An: Dovecot Mailing List dovecot@dovecot.org Betreff: Re: sieve filter bevor.spam, arnt take effect
Hello, (Excuse me for top-posting, but the message below is too messy)
Your sieve config according to "dovecot -n" does not match what you have in 90-sieve.conf.
Have you deleted the line "!include conf.d/*.conf" in doveconf.conf?
Please double check that, as your config may not be what you'd expect it to be.. Cheers.
On Mon, 12 Apr 2021, Maurizio Caloro wrote:
Hello
Please willing to filter "bevor spam" mail... filtering arnt take effect .. please i dont see the mistake. Thanks for any possible update Debian buster
Hi again, Your dovecot.conf neither contains the sieve settings nor includes the conf.d/90-sieve.conf file, which means that you only get whatever >default config dovecot includes. Good luck..
Now i put everyting that I "need" for forward spam to folder Junk-E-Mail.tje the goal are that the spam email that will deliver direct to Junk-E-Mail folder.
root@nmail:/etc/dovecot# cat dovecot.conf # 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.16 (fed8554) # OS: Linux 4.9.0-12-amd64 x86_64 Debian 9.12 # Enable installed protocols !include_try /usr/share/dovecot/protocols.d/*.protocol auth_mechanisms = plain login auth_verbose = yes disable_plaintext_auth = yes info_log_path = /var/log/mail.log log_timestamp = %b %d %H:%M:%S Dovecot/ mail_access_groups = vmail mail_location = maildir:~/Maildir managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk-E-Mail { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = }
passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
protocols = imap lmtp sieve
service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-client { mode = 0660 user = mail } } service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } }
service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { mode = 0600 user = postfix group = postfix } }
postmaster_address = mca@caloro.ch
protocol lda { # Space separated list of plugins to load (default is global mail_plugins). mail_plugins = $mail_plugins quota sieve }
ssl = required ssl_key =
ssl_dh=
ssl_min_protocol=TLSv1.2 ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
protocol imap { ssl_key =
plugin { # The path to the user's main active script. If ManageSieve is used, this the # location of the symbolic link controlled by ManageSieve.
sieve = file:%h/sieve;active=%h/.dovecot.sieve
sieve_before = /etc/dovecot/sieve/before.sieve
}
service stats { unix_listener stats-reader { group = vmail mode = 0666 user = vmail } unix_listener stats-writer { group = vmail mode = 0666 user = vmail } }
-- Cat /etc/dovecot/sieve/before.sieve
require "fileinto";
if exists "X-Spam-Flag" {
if header :contains "X-Spam-Flag" "YES" {
} else {
fileinto "Junk E-Mail";
stop;
}
}
On Mon, 12 Apr 2021, mauric@gmx.ch wrote:
Hi again, Your dovecot.conf neither contains the sieve settings nor includes the conf.d/90-sieve.conf file, which means that you only get whatever default config dovecot includes. Good luck..
Now i put everyting that I "need" for forward spam to folder Junk-E-Mail.tje the goal are that the spam email that will deliver direct to Junk-E-Mail folder.
I'm not sure if you still have a question, or if everything works as expected?
Please note that:
sieve-before scripts must be compiled (with sievec) read: https://doc.dovecot.org/configuration_manual/sieve/usage/
Your script seems to do nothing if X-Spam-Flag is YES. If no such flag, then it is filed into "Junk E-Mail".
require "fileinto"; if exists "X-Spam-Flag" { if header :contains "X-Spam-Flag" "YES" { } else { fileinto "Junk E-Mail"; stop; } }
You probably want the opposite (and you may want to considering formatting your script better.. for clarity)
- Your script does 'fileinto "Junk E-Mail"' but no such mailbox is there. Your config has a "Junk-E-Mail".
mailbox Junk-E-Mail { special_use = \Junk }
Maybe you want to check the logs and see what's actually happening.
Maybe you're not even using LDA/LMTP, so you may want to post your postfix configuration (assuming you're using postfix).
I don't think I can help any more here, but if you have further questions it might be wise to write them in a language you're more comfortable with?
Good luck.
Thanks for your answer.... after remark this line restart the service and nothing changed...
oot@nmail:/etc/dovecot# cat dovecot.conf # 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.16 (fed8554) # OS: Linux 4.9.0-12-amd64 x86_64 Debian 9.12
# Enable installed protocols !include_try /usr/share/dovecot/protocols.d/*.protocol auth_mechanisms = plain login auth_verbose = yes disable_plaintext_auth = yes info_log_path = /var/log/mail.log log_timestamp = %b %d %H:%M:%S Dovecot/ mail_access_groups = vmail mail_location = maildir:~/Maildir managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
postmaster_address = mca@caloro.ch
protocols = imap lmtp sieve
service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-client { mode = 0660 user = mail } } service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } }
service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { mode = 0600 user = postfix group = postfix } }
ssl = required ssl_key =
ssl_dh=
ssl_min_protocol=TLSv1.2 ssl_cipher_list = ECDHE-RSA-CHACHA20-POLY1305:ALL:!LOW:!SSLv2:!EXP:!aNULL
userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql }
protocol imap { ssl_key =
service stats { unix_listener stats-reader { group = vmail mode = 0666 user = vmail } unix_listener stats-writer { group = vmail mode = 0666 user = vmail } }
## ## !include_try local.conf
-----Ursprüngliche Nachricht----- Von: dovecot dovecot-bounces@dovecot.org Im Auftrag von Bernardo Reino Gesendet: Montag, 12. April 2021 16:01 An: Dovecot Mailing List dovecot@dovecot.org Betreff: Re: sieve filter bevor.spam, arnt take effect
Hello, (Excuse me for top-posting, but the message below is too messy)
Your sieve config according to "dovecot -n" does not match what you have in 90-sieve.conf.
Have you deleted the line "!include conf.d/*.conf" in doveconf.conf?
Please double check that, as your config may not be what you'd expect it to be.. Cheers.
On Mon, 12 Apr 2021, Maurizio Caloro wrote:
Hello
Please willing to filter "bevor spam" mail... filtering arnt take effect .. please i dont see the mistake. Thanks for any possible update Debian buster
participants (3)
-
Bernardo Reino
-
mauric@gmx.ch
-
Maurizio Caloro