Dovecot Server To Automatically Mark Spam Mails

install and enable SpamAssassin

dnf install spamassassin
groupadd spamd
useradd -g spamd -s /usr/sbin/nologin -d /var/log/spamd spamd
chown spamd:spamd /var/log/spamd

/etc/postfix/master.cf

smtp inet n – – – – smtpd
-o content_filter=spamassassin

# add a new line after “smtp” line . need space before -o.

# add below at the end of file.

spamassassin unix – n n – – pipe
user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

systemctl enable spamassassin
systemctl start spamassassin
systemctl reload postfix

config spamassassin to mark mails which credit score is under 5.

cat >> /etc/mail/spamassassin/local.cf << 'EOF'

required_score 5.0
use_bayes 1
bayes_auto_learn 1
EOF
systemctl restart spamassassin

spamassassin will automatically add [SPAM] before the mail title.

コメントを残す