Posted in

Synology: Sort spam status header in MailPlus Server

By default the contents of the X-Synology-Spam-Status header are unsorted. Making it difficult to understand why a certain mail is flagged as spam or ham. Here is a tweak to sort the header by score.

Situation

Normally you can instruct rspamd to order the symbols by their score using the sort_scores setting. So the highest scoring symbols are listed first, then going down to the negative scores at the end. But because of how Synology is generating the header, the sort_scores setting has no effect. They are appended to the status message by iteration.

These instructions add a few lines of code to the generator, without interfering with the rest of the processing. The trick is to add a table.sort statement to the synology.lua script, just before the symbols are processed.

How to fix

Edit the synology.lua file:

First make sure nano is installed. It is available in the Package Center in the SynoCli File Tools package, when you add the SynoCommunity repository. Or replace the nano mentions with your favorite editor.

Open the SSH terminal with an admin user account.

 
sudo nano '/volume1/@appstore/MailPlus-Server/etc/rspamd/synology.lua'

Now it is important to know your MailPlus Server version. You can find it in DSM → Package CenterInstalled tab (left column) → Synology MailPlus ServerInstalled version

Leave a Reply

Your email address will not be published. Required fields are marked *