# SpamAssassin in the health score

When SpamAssassin is installed on your machine, `jadpo dev` adds its
rules to each mail's health score. Without it, the score is Jadpo's own
seven checks ([The dev inbox and the health score](the-dev-inbox-and-the-health-score.md)).

## When it runs

`jadpo dev` hands each mail to `spamassassin` on the `PATH` as it
catches the mail, before keeping it, off the worker's thread. The mail
is as the SMTP driver writes it, with the `Message-ID:` a submission
server adds. What SpamAssassin found is kept with the mail, and a mail
is never scored again.

Jadpo runs only `spamassassin`, never `spamc`, whose daemon's network
tests aren't Jadpo's to switch off. It runs with `-L -t -x` and
`bayes_auto_learn 0`: no network tests, no preferences made and nothing
learnt. A run is given up after 30 seconds. The mail goes to its
standard input only, its standard error is thrown away, and nothing it
read is logged.

## What is kept

Jadpo keeps the last report SpamAssassin prints: its score, the score it
calls spam at, and each rule that matched with its points and
description, the most points first. A line quoting the mail
(`[URIs: …]`) is left out. Decimals stay as SpamAssassin wrote them, as
text in `--json`.

## How it changes the score

A mail SpamAssassin calls spam, its score at or over its threshold, has
one more problem. "N of 7 checks pass" stays Jadpo's own count.
`jadpo email show` and the page's health view list SpamAssassin's rules
after Jadpo's checks, with points over zero in the warning colour. The
score's line and the page's strip name SpamAssassin's verdict. A mail is
called "clean" only when SpamAssassin scored it too.

## When it wasn't run

SpamAssassin may not be installed, the mail may have been caught before
it was run, or there may be no report, because a run failed, was too
slow, or printed a report that couldn't be read. Each case says that
SpamAssassin wasn't run or couldn't score the mail, that its rules
aren't in the score, and what to do. None says the mail is clean.

Jadpo's own tests of this fake SpamAssassin's run, so nothing needs
installing for them.
