Use spamassassin from fetchmail – no mta config, no procmail

Once you get it, you get it.

mda "/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f %F %T"

It’s really easy with the MDA option from fetchmail. I’m on ubuntu-18.04 but it works with similar versions and debian too. Make sure your version of fetchmail supports the MDA config option!

I will not cover how to install and configure spamassassin here, we assume it’s installed and has a basic working setup. Same for fetchmail of course. You can run fetchmail as a system service, call it from cron, have global or per user config, the only “magic” is to add the mda option like this to call spamassassin and have it deliver the mail locally afterwards:

poll mail.server.tld with proto whatever user remoteuser there with password "s3cr3t4ndS3cur3" is localuser here use ssl and fetchall mda "/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f %F %T"

As you can see, keep whatever your poll line looks like, just add the MDA option in the end like the example shows. It assumes your MTA comes with a sendmail compatible wrapper (most do, certainly postfix does).