So I integrated SpamAssassin into my mailman3 server the other day, using the ubuntu packages which implement the “standard” SpamAssassin install with a filter on port 25 and re-injection using /usr/sbin/sendmail.
From postfix/master.cf:
# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - 10 smtpd -o content_filter=spamassassin
spamassassin unix - n n - - pipe user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
The problem there, of course, is that mailman3 traffic gets scanned twice: once on the way in from the original sender and once on the way out as mailman3 duplicates it to list recipients. This is because out-of-the-box mailman3 tends to be configured to re-inject list email via port 25, which is scanning for spam on incoming email. This is horribly inefficient, obviously, and gets worse the bigger your mailing list is. Given that it’s written in Perl, SpamAssassin isn’t the most efficient thing in the first place.
Anyway, I got literally zero hits on solving this when I googled it, so here’s mine to save future mailman3+SpamAssassin users some grief.
The easy fix was to edit the [mta] setting in mailman.cfg to deliver email via the submit port instead, which has no filtering applied to it:
smtp_host: localhost # using the submit port bypasses spamassassin filtering on outgoing list email smtp_port: 587 smtp_user: mm3send <— I created this user for this purpose smtp_pass: <password-for-mm3send-user>
This works great and can be applied to any email filtering.
FYI.
- Mark
mark@pdc-racing.net | 408-348-2878