====== Настройка spamassassin ====== На основе Debian 12 apt install spamassassin spamc Добавить строку **-o content_filter=spamassassin** в smtp, smtps, и, может быть, в submission.\\ Туда же spamassassin. 2048000 - максимальный размер обрабатываемых писем. smtp inet n - - - - smtpd -o content_filter=spamassassin smtps inet n - - - - smtpd -o content_filter=spamassassin #submission inet n - - - - smtpd # -o content_filter=spamassassin spamassassin unix - n n - - pipe user=debian-spamd argv=/usr/bin/spamc -s 2048000 -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient} Настроить под себя rewrite_header Subject *****SPAM***** report_safe 0 trusted_networks 192.168/16 Автоматически перемещать спам в папку Junk с помощью плагина sieve от dovecot. apt install dovecot-sieve dovecot-managesieved mkdir -p /etc/dovecot/sieve/global touch /etc/dovecot/sieve/global/before.sieve chown -R vmail: /etc/dovecot/sieve require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; } mail_location = maildir:/var/mail/%d/%n mail_home = /var/mail/%d/%n/sieve plugin { sieve_dir = /var/mail/%d/%n/sieve sieve_before = /etc/dovecot/sieve/global/before.sieve } namespace inbox { ... mailbox Junk { auto = create # Автосоздание папки Junk special_use = \Junk } ... systemctl restart postfix dovecot spamd