Search code examples
procmailspamassassin

Despite X-Spam-Status Scores above Required Spam isn't sorted out of mbox


I'm trying to run my mbox file through spamassassin with:

formail -s procmail ~/procmail.rc < mbox

Despite what I think looks like a proper procmail rc file & an ok spamassassin local.cf the mail that gets scored higher than my 'required' is not being filtered into my probably-spam folder.

Any spamassassin experts who can help? This is on Ubuntu 16.04LTS

From my email header:

 X-Spam-Status: No, score=-5.0 required=3.0 tests=RCVD_IN_DNSWL_HI,SPF_PASS,
T_RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1

My spamassassin local.cf:

rewrite_header Subject *****SPAM*****
report_safe 0
required_score 3.0
use_bayes 1
bayes_auto_learn 1
normalize_charset 1
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
shortcircuit BAYES_99                spam
shortcircuit BAYES_00                ham
endif # Mail::SpamAssassin::Plugin::Shortcircuit

My procmailrc:

:0fw: spamassassin.lock
* < 256000
| spamassassin


:0:
* ^X-Spam-Level: \*\*\*
almost-certainly-spam

:0:
* ^X-Spam-Status: Yes
probably-spam

# Work around procmail bug: any output on stderr will cause the "F" in 
"From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

:0 fhw
| sed -e '1s/^/F/'
}

Solution

  • I cannot see any apparent mistakes in your spamassassin local.cf and procmailrc. But the example email header clearly says that it is no spam. The score is not higher, it is -5 which is lower than 3. Hence it says "X-Spam-Status: No".

    Note that the procmail workaround should not be needed anymore. However, you might want to use -f -, i.e.

     formail -s procmail -f - ~/procmail.rc < mbox