Hi every body. I'm having difficulties to setup my filters correctly
and I really need some help.
This is my environment:
Mail that is received on the system passes through a sieve_before
script that checks the message header for SPAM tag and store it into
the "Junk" folder. If no spam tag is found, mail goes to inbox.
My horde webmail is integrated with sieve, so this allow users to
create their own scripts to store mail in other folders or forward
them to external accounts. And this are the problems I'm having:
1 - When users create a forward filter to redirect to external mail,
mail that is stored inside the Junk folder are not forwarded;
2 - If I insert a "keep" parameter inside the sieve_before script to
keep processing the rules, the mail is forwarded, but becomes
duplicated and stored inside the inbox or other folders, if the user
has more filters.
3 - If I move my sieve_before script to sieve_after, the same thing
happened, one copy is stored on the user selected folder (inbox or
filtered), including mail marked as SPAM.
My needs are: I need to separate SPAM and HAM e-mail before users
intervention (so I need sieve_before). But this SPAM e-mail has to be
forwarded if a forward filter is created.
Is it possible to use a sieve_after script that moves (instead of
copy) the user mail marked as SPAM to the Junk folder even if it was
stored in a different folder?
Is that possible?
Thanks a lot.
Here is my config:
sieve_after content: require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; }
dovecot --version 2.2.10
2.2.10: /etc/dovecot/dovecot.conf
OS: Linux 3.10.0-327.28.2.el7.x86_64 x86_64 CentOS Linux release
7.2.1511 (Core)
auth_cache_negative_ttl = 0
auth_cache_size = 10 M
auth_mechanisms = plain login
auth_username_format = %Ln
default_client_limit = 1024
default_process_limit = 1024
default_vsz_limit = 1 G
mail_location = maildir:~/Maildir:INDEX=/var/indexes/dovecot/%u
mail_plugins = " mail_log notify quota"
mail_temp_dir = /var/tmp
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 imapflags notify
mbox_write_locks = fcntl
mmap_disable = yes
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 {
driver = pam
}
passdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
plugin {
mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename
mail_log_fields = uid box msgid size
quota = maildir
quota_exceeded_message = Cota de armazenamento de e-mails excedida.
Quota exceeded for mail store.
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=85%% quota-warning 85 %u
quota_warning3 = storage=75%% quota-warning 75 %u
sieve = ~/.dovecot.sieve
sieve_before = /var/lib/dovecot/sieve/default.sieve
sieve_default = /var/lib/dovecot/sieve/default.sieve
sieve_dir = ~/sieve
sieve_extensions = +notify +imapflags
}
protocols = imap pop3 lmtp sieve
service anvil {
client_limit = 14100
process_limit = 1
}
service auth-worker {
client_limit = 1
process_limit = 50
service_count = 1
}
service auth {
client_limit = 15100
process_limit = 1
}
service dict {
client_limit = 1
}
service imap-login {
inet_listener imap {
port = 143
}
inet_listener imaps {
port = 993
ssl = yes
}
process_limit = 6000
process_min_avail = 10
service_count = 1
vsz_limit = 256 M
}
service imap {
process_limit = 3000
vsz_limit = 1 G
}
service lmtp {
client_limit = 1
inet_listener lmtp {
port = 24
}
unix_listener lmtp {
mode = 0666
}
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
service pop3-login {
inet_listener pop3 {
port = 110
}
inet_listener pop3s {
port = 995
ssl = yes
}
process_limit = 6000
process_min_avail = 10
service_count = 1
}
service pop3 {
process_limit = 3000
}
service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
unix_listener quota-warning {
mode = 0666
user = dovecot
}
user = root
}
ssl = required
ssl_cert = **************
ssl_key = **************
userdb {
driver = passwd
}
userdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
protocol lmtp {
mail_plugins = " mail_log notify quota sieve quota"
}
protocol imap {
mail_plugins = " mail_log notify quota imap_quota"
}
Atenciosamente
André Luiz Paiz
Administração de Redes
Instituto de Química – Unicamp
andre.paiz@iqm.unicamp.br
Telefone: (19)3521-0197
Am 12.09.2016 um 15:07 schrieb Andre Luiz Paiz:
i have a nearly the same setup incl Horde , solved like this
spam tag added via spamass-milter and postfix, dove lmtp
/etc/dovecot/sieve/global.sieve ... if header :contains "X-Spam-Flag" "YES" {fileinto "Junk";stop;} ...
http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples
90-sieve.conf ... sieve = file:~/sieve;active=~/.dovecot.sieve ... #sieve_default = /var/lib/dovecot/sieve/default.sieve ... sieve_global = /etc/dovecot/sieve/ ...
i use no sieve includes
that forces the spam filter act ever, only mail that went inbox can be redirected by user scripts later
but check if this may fit to your dove setup
Best Regards MfG Robert Schetterer
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Schleißheimer Straße 26/MG, 80333 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein
Quoting Robert Schetterer <rs@sys4.de>:
Thanks for you reply.
My needs are almost there. In my case I need that SPAM mails also be
redirected with the forward filter, even after it was sended to the
Junk folder. Is that possible without creating duplicated messages
(one in the Junk folder and another inside the inbox or another user
folder)?
Atenciosamente
André Luiz Paiz
Administração de Redes
Instituto de Química – Unicamp
andre.paiz@iqm.unicamp.br
Telefone: (19)3521-0197
Am 12.09.2016 um 15:59 schrieb Andre Luiz Paiz:
In my case I need that SPAM mails also be redirected with the forward filter
sorry i dont understand why this should be needed ever, please explain
Best Regards MfG Robert Schetterer
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Schleißheimer Straße 26/MG, 80333 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein
Quoting Robert Schetterer <rs@sys4.de>:
In case of false-positive. Some users prefer to redirect their e-mail
to their external providers instead of using our corporate network
webmail. And they want all e-mail to be forwarded.
Atenciosamente
André Luiz Paiz
Administração de Redes
Instituto de Química – Unicamp
andre.paiz@iqm.unicamp.br
Telefone: (19)3521-0197
Am 12.09.2016 um 19:25 schrieb Andre Luiz Paiz:
then solve it via i.e postfix transport etc, thats not a native sieve job if you need a user gui for that ,postfixadmin , modoboa etc should work
but however forwarding spam external is a very, very bad idea, external networks will punish your server for doing so
Best Regards MfG Robert Schetterer
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Schleißheimer Straße 26/MG, 80333 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein
Op 12-9-2016 om 15:07 schreef Andre Luiz Paiz:
In the script sequence, it is currently only possible to decide whether the next script will execute or not by executing (implicit) keep. It is currently not possible to somehow influence which actions subsequent scripts can still execute.
Also, once a script is executed, its actions are final. It is not possible to undo actions performed by earlier Sieve scripts from within Sieve scripts executed later in the script sequence.
At this time, I also don't see how this could be implemented cleanly.
I am fresh out of ideas. :/
Regards
Stephan.
Can't you store it the spam folder in the before script, send it on and then discard it in the after script.
This would of course miss mails that are stored somewhere else by user rules, fx mailinglist spam, but it handles the simple case.
/Daniel
On 2016-09-12 15:07, Andre Luiz Paiz wrote:
participants (4)
-
Andre Luiz Paiz
-
Daniel Demus
-
Robert Schetterer
-
Stephan Bosch