I'm a newbie trying to work out the following mail solution on a laptop where I'm the only user:

getmail - spamassassin - procmail - mu4e (an emacs mail program)

Right now I'm succeeding at

getmail                -            mu4e

With my former mail program (emacs gnus) I was successfully implementing spamassassin as spamd daemon.

I think I understand how to tell getmail to filter mail through spamassassin and send it on to procmail. How should I write my .procmailrc file to send spamassassin-processed mail on to its final "spam" or "not-spam" destination in my email program?


I would suggest using fetchmail (with mda option) instead of getmail.

getmail configuration: ~/.getmail/getmailrc - deliver via procmail

To deliver with an external MDA:

type = MultiDestination
destinations = ("[procmail-as-bob]", )

type = MDA_external
path = /path/to/procmail
arguments = ('~bob/.procmailrc', '-f', '%(sender)')
user = bob

procmail configuration with spamassassin/spamc: ~/.procmailrc

# default/fallback delivery destination

# rewrite message using spamassassin or spamc
# :spamassassin.lock lock is not necessary for spamc 
# (it makes some sense for spamassassin)
:0fw: spamassassin.lock
* < 256000
| spamc

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mailbox. (This one is optional.)
# locking (trailing : ) is not necessary for deliveries to maildir 
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
# locking (trailing : ) is not necessary for deliveries to maildir
* ^X-Spam-Status: Yes
  • Note that \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* can be rewritten as \*{15,} to better emphasize the numerical score value. – user Aug 14 '15 at 8:30
  • @MichaelKjörling No, Procmail does not support the {m,n} repetition operator found in e.g. egrep. – tripleee Aug 14 '15 at 10:22
  • What's with the spamassassin.lock file? I know what it does, and I have frequently seen it copy/pasted in this particular recipe construct, but I have never seen a satisfying explanation of why you would want to prevent multiple simultaneous invocations of spamc. Indeed, the point of spamc/spamd is to allow for multiple parallel invocations. – tripleee Aug 14 '15 at 10:24
  • @tripleee :spamassassin.lock makes more sense with spamassassin used in original recipe. – AnFi Aug 14 '15 at 10:51
  • 1
    @StevenArntson It may be extended to execute procmail with per external email account rc file OR pass external account name to ~/.procmailrc. – AnFi Aug 14 '15 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.