Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like a way to test a spam message to see its spam scores that SpamAssassin gives it. The SA db files (bayes_toks, etc) reside in /var/lib/amavis/.spamassassin. I've been testing emails by doing this:

sudo su amavis -c 'spamassassin -t msgfile'

Though this yields some strange results, such as:

Content analysis details:   (3.7 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 3.5 BAYES_99               BODY: Bayes spam probability is 99 to 100%
                            [score: 1.0000]
-0.0 NO_RELAYS              Informational: message was not relayed via SMTP
 0.2 BAYES_999              BODY: Bayes spam probability is 99.9 to 100%
                            [score: 1.0000]
-0.0 NO_RECEIVED            Informational: message has no Received headers

0.2 is an awfully low scores for BAYES_999! But this is the first time I've used amavis, previously I've always just used spamassassin directly as a content filter in postfix, but apparently running amavis/spamassassin is more efficient.

So, with amavis in the picture, how can I run a test on a message to see its spam score breakdown?

Another email I ran a test on got this result:

 2.0 BAYES_80               BODY: Bayes spam probability is 80 to 95%
                        [score: 0.8487]

Doesn't make sense, that BAYES_80 can yield a higher score than BAYES_999. Help!

share|improve this question

The rules are cumulative. In some cases, such as this you will have overlapping rules triggered.

Bayes 99 to 99.9 Scores 3.5

3.5 BAYES_99               BODY: Bayes spam probability is 99 to 100%
                           [score: 1.0000]

Bayes 99.9 to 100% triggers two rules and scores 3.7.

3.5 BAYES_99               BODY: Bayes spam probability is 99 to 100%
                           [score: 1.0000]
0.2 BAYES_999              BODY: Bayes spam probability is 99.9 to 100%
                           [score: 1.0000]

EDIT: Amavis does seem to support testing directly.

There are some hint on testing on the mailing list. This indicates something like the following.

mini_sendmail -ftest at -s127.0.0.1 \
     -p8888 postmaster at <test.msg

It may be possible to generate a test configuration that delivers messages to a file. See the above mailing list thread.

The amavis-new documentation indicates these is some documentation in the distribution. In particular, 'test-messages/README'.

Amavis works by re-injecting mail back into your MTA. This can result in back-scatter spam.

share|improve this answer
This didn't actually answer the question. I was asking how to test email messages on the command line using amavis. – CaptSaltyJack Aug 20 '14 at 2:59
@CaptSaltyJack I've added testing notes. – BillThor Aug 21 '14 at 0:18
The question was how to properly test an email that is going through amavis first. Actually I think the answer is, it's not possible. Once it passes through amavis, it's kind of a different message and is trusted even more since it was delivered by localhost. – CaptSaltyJack Aug 21 '14 at 0:26
@CaptSaltyJack According to the documentation amavis logs its activity, so you merely need to look in the logs. Also, you will have a second received header from when amavis re-injects the message into your MTA. I don't understand your new interpretation of what you asked. I think that what you asked is may not be what you intended to ask. – BillThor Aug 21 '14 at 0:38
My goal is to not see what scores it got, I can see that from the header. My goal is to actually run a command to test a message to see how it would score (from amavis's perspective). – CaptSaltyJack Aug 21 '14 at 0:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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