[TUTORIAL] Custom Spamreport Template

Hello everyone,

I have taken the trouble to make my spam report a little prettier.

I wanted to share the result with you and hope it's OK. If this is not desired, please delete my post.

The aim was to make the whole look and feel a bit more modern and user-friendly, to refresh it completely and to translate it into German without restricting the functions.

I have applied a bit of HTML and CSS and take some help of ChatGPT to centralise the report boxed. At the top there is a header with a background colour and an embedded logo. The header has a forced paragraph and the date format is formatted to dd.mm.yyyy everywhere.

The action links are now displayed as buttons.

At the bottom there is a section for the reference to the web interface and a disclaimer.
I have censored the recipient e-mail address here:

1738065631643.png

I tested the spam report with MS Outlook 2019-2024, Exchange OWA & iOS.

The source code must be saved once as spamreport-custom.tt:
Code:
nano /var/lib/pmg/templates/spamreport-custom.tt

If you are using a PMG cluster, you must copy the file to all nodes.

In order to use the custom template, you must set ‘User Spamreport Style’ to Custom in the GUI under Configuration > SPAM Detector > Quarantine.

You can then test the whole thing using:
Code:
pmgqm send --receiver email@yourdomain.com
However, a spam report is only sent if the specified e-mail address currently also has objects in quarantine



I have attached the source code of my spamreport-custom.tt. I have added comments to some lines; colours, logo, buttons and disclaimer are all freely editable.
 

Attachments

Last edited:
Found your post (and appreciate it) whilst searching an idea on how to change verbose template. Coming from 8 to 9 upgrade earlier this week I'd like to mention an in-place edit of these templates is prone for overwrite during upgrade process. Although you'd normally be asked for confirmation.

Documentation recommends to copy templates (c.f. Admin Guide in chapter 4.3) like so for example:

Bash:
mkdir /etc/pmg/templates
cp /var/lib/pmg/templates/spamreport-verbose.tt /etc/pmg/templates/
pmgconfig sync --restart 1

End then work on copies of the system templates.