Привет, все мучаюсь с sieve, но никак не получается победить.
Надо сделать сортировку по папкам в зависимости от отправителя, а так же борьба со спамом.
Вот что сделано:
- Настроен dovecot
protocols = imap sieve managesieve managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comperator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date service managesieve-login { inet_listener sieve { port = 4190 } service_count = 1 process_min_avail = 0 vsz_limit = 64M } service managesieve { process_limit = 1024 } protocol sieve { mail_max_userip_connections = 10 mail_plugins = managesieve_implementation_string = Dovecot Pigeonhole managesieve_logout_format = bytes=%i/%o managesieve_max_compile_errors = 5 managesieve_max_line_length = 65536 managesieve_notify_capability = managesieve_sieve_capability = } protocol lmtp { mail_plugins = $mail_plugins sieve } plugin { sieve = /home/mail/post.com/new/sieve/1.sieve sieve_dir = /etc/dovecot/sieve-after sieve_global_dir = /etc/dovecot/sieve-after/ sieve_before = /etc/dovecot/sieve-after/spam-to-folder.sieve sieve_default = /etc/dovecot/sieve-after/spam-to-folder.sieve sieve_max_script_size = 1M # Максимальный размер одного скрипта sieve_quota_max_scripts = 50 # Максимальное количество скриптов sieve_quota_max_storage = 1M # Максимальный общий объём скриптов sieve_max_actions = 32 # Максимальное количество действий, которые можно выполнить за одно выполнение скрипта. sieve_max_redirects = 4 # Максимальное количество действий по перенаправлению sieve_extensions = +spamtest +spamtestplus +virustest sieve_spamtest_status_type = score sieve_spamtest_status_header = \ X-Spam-Score: score=(-?[[:digit:]]+\.[[:digit:]]).* sieve_spamtest_max_header = \ X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]] required=([[:digit:]]+\.[[:digit:]]) sieve_virustest_status_type = text sieve_virustest_status_header = X-Virus-Scan: Found to be (.+)\. sieve_virustest_text_value1 = clean sieve_virustest_text_value5 = infected } lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes protocol lda { mail_plugins = $mail_plugins quota acl expire sieve mail_plugins = cmusieve mail_plugin_dir = /usr/lib/dovecot/dovecot-lda }
- postfix
main.cf
master.cfmailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
dovecot unix - n n - - pipe flags=DRhu user=vmail:mail [br]argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop} -a ${original_recipient}[br]
- Конфиг sieve
require ["imap4flags", "fileinto", "variables", "date"]; if allof (header :contains "From" "test3@post.com") { fileinto "Friends"; stop; }
if header :comparator "i;ascii-casemap" :contains "subject" "*****SPAM*****" { fileinto ".Junk"; stop; } else { keep; }