I wanted spamassassin to be called only when external mail arrives.
Here's what I used - after a lot of faffing around. From memory it inspects the last From: header. It only scans for spam if the user has set up a "Spam" folder also: #/etc/procmailrc RMIN = 1 # set to your Received count for local mail; may well be 1 WS = ' ' # a space and a tab inside the single-quotes MYSERVER = mypc.mydomain.com # Substitute your mailserver here :0 * $ 1^1 ^Received: from \/[^$WS]+ { RCOUNT = $= BOTTOMHOST = $MATCH :0fw: spamassassin.lock * $ $RCOUNT ^0 * $ -$RMIN ^0 MATCH ?? ^^$\MYSERVER^^ * < 256000 * ? test -d $HOME/.maildir/.Spam | /usr/bin/spamc }