Bug 451369 - Header of a message shows "Spamassassin" for "Spam Status", despite using another spam filter
Summary: Header of a message shows "Spamassassin" for "Spam Status", despite using ano...
Status: RESOLVED NOT A BUG
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: 5.16.3
Platform: Kubuntu Linux
: NOR minor (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-10 18:00 UTC by CaCO3
Modified: 2022-03-10 20:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot (30.70 KB, image/png)
2022-03-10 18:00 UTC, CaCO3
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CaCO3 2022-03-10 18:00:49 UTC
Created attachment 147424 [details]
Screenshot

The header of a mail shows "Spamassassin" for the "Spam Status" field, despite using another spam filter. See attachment.

I think it is defined by the field "header.spamHTML", but I can not find it in the source code.

Expectation:
It should use the name as defined in the mail header field "X-Spam-Checker-Version".

I am willing to create a patch myself if somebody can point me to the right source code fragment.

Notes:
 * The field "header.spamHTML" is also referenced in the grantlee-editor, see https://github.com/KDE/grantlee-editor/blob/master/headerthemeeditor/README.theme#L37
* The field "X-Spam-Checker-Version" seems only to be referenced by SpamAssassin, eg. https://spamassassin.apache.org/full/2.6x/dist/doc/Mail_SpamAssassin_PerMsgStatus.html, how ever IMO it should be a generic field usable by any spam filter.
Comment 1 Laurent Montel 2022-03-10 19:08:24 UTC
Hi,
Which are your spam detector ?

We defined name from a specific flag.
For example SpamAssassin uses "DetectionHeader=X-Spam-Flag"
=> if your spam detector use it too it will be detect as spamassassin.

Perhaps we can add your spam detector in list otherwise it will use this name.

Perhaps you can send me an example of mail as private.

Regards
Comment 2 CaCO3 2022-03-10 19:29:54 UTC
I created my own (2nd stage) spam filter. It basically is a Bayesian Filter run on server side. It prepends the following fields onto my mails:
X-Spam-Checker-Version: CaCO3s Personal Mail Filter (2022-03-08)
X-Spam-Flag: NO
X-Spam-Status: NO, score=25 required=600 
X-Spam-Report:
	* WORD_CLASSIFIER

I adapted those headers by try and error and found that kmail needs X-Spam-Status and X-Spam-Report for correctly showing the score correctly in the score bar.

I am aware that additionally there are the same fields used for spamassassin (1th stage spam filter) further down in the header, but kmail seems to use the fields first found in the mail.

Below an example mail content:
X-Spam-Checker-Version: CaCO3s Personal Mail Filter (2022-03-08)
X-Spam-Flag: NO
X-Spam-Status: NO, score=25 required=600 
X-Spam-Report:
	* WORD_CLASSIFIER
[..]
X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20)
X-Spam-Level: 
X-Spam-Status: No, score=-9.2 required=4.0 tests=BAYES_00,DKIMWL_WL_HIGH,
	[..]
Comment 3 CaCO3 2022-03-10 19:36:30 UTC
Note: Even there is no X-Spam-Flag field in the mail, it is named as SpamAssassin!

Spamassassin itself actually did only add those fields:
X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on
	mxin014.mail.hostpoint.ch
X-Spam-Level: 
X-Spam-Status: No, score=-5.6 required=4.0 tests=BAYES_00,HP_VS_LEGIT,
	RCVD_IN_DNSWL_LOW,RCVD_IN_HPWL_LOW,SPF_HELO_NONE,SPF_PASS,
	TVD_SPACE_RATIO,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no
	version=3.4.5
Comment 4 Laurent Montel 2022-03-10 19:42:59 UTC
(In reply to CaCO3 from comment #3)
> Note: Even there is no X-Spam-Flag field in the mail, it is named as
> SpamAssassin!
> 
> Spamassassin itself actually did only add those fields:
> X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on
> 	mxin014.mail.hostpoint.ch
> X-Spam-Level: 
> X-Spam-Status: No, score=-5.6 required=4.0 tests=BAYES_00,HP_VS_LEGIT,
> 	RCVD_IN_DNSWL_LOW,RCVD_IN_HPWL_LOW,SPF_HELO_NONE,SPF_PASS,
> 	TVD_SPACE_RATIO,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no
> 	version=3.4.5

see kdepim-addons/kmail/plugins/common/kmail.antispamrc

As it's an own spam detector we can't add it in kmail.
If you want to add another on you need to use a specific ScoreHeader: + DetectionHeader
Custom it and it will work for you.
Regards.
Comment 5 CaCO3 2022-03-10 20:47:48 UTC
Thank you for your quick and detailed explanations!

I was now able to add my own detector in /etc/xdg/kmail.antispamrc