[pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report

Hannes Laimer h.laimer at proxmox.com
Fri Sep 19 10:36:21 CEST 2025


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
v3:
- drop link for individual mail, now just one link on top for management
- add actually needed `subject:` line back in

 src/Makefile                              |  2 ++
 src/templates/spamreport-short.plain.tt   | 17 +++++++++++++++++
 src/templates/spamreport-verbose.plain.tt | 22 ++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 src/templates/spamreport-short.plain.tt
 create mode 100644 src/templates/spamreport-verbose.plain.tt

diff --git a/src/Makefile b/src/Makefile
index 6c4246f..54825e2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,7 +27,9 @@ TEMPLATES =				\
 	fetchmailrc.tt			\
 	pmgreport.tt			\
 	spamreport-verbose.tt		\
+	spamreport-verbose.plain.tt	\
 	spamreport-short.tt		\
+	spamreport-short.plain.tt	\
 	main.cf.in			\
 	main.cf.in.demo			\
 	master.cf.in			\
diff --git a/src/templates/spamreport-short.plain.tt b/src/templates/spamreport-short.plain.tt
new file mode 100644
index 0000000..8ac89b4
--- /dev/null
+++ b/src/templates/spamreport-short.plain.tt
@@ -0,0 +1,17 @@
+[% IF timespan == 'week' -%]
+[% SET title = "Weekly Spam Report for '${pmail}' - ${date}'" -%]
+[% ELSIF timespan.substr(timespan.length - 1) == 'h' -%]
+[% SET title = "Spam Report (last ${timespan}) for '${pmail}' - ${date}" -%]
+[% ELSE -%]
+[% SET title = "Daily Spam Report for '${pmail}' - ${date}" -%]
+[% END -%]
+subject: [% title %]
+You received [% mailcount %] spam mail(s).
+
+[% SET links = [] %]
+Manage your spam quarantine: [% n = links.size + 1; links.push(managehref); %][[% n %]]
+Powered by Proxmox: [% n = links.size + 1; links.push('http://www.proxmox.com'); %][[% n %]]
+
+Links:
+[% FOREACH l IN links %][% loop.index + 1 %]: [% l %]
+[% END %]
diff --git a/src/templates/spamreport-verbose.plain.tt b/src/templates/spamreport-verbose.plain.tt
new file mode 100644
index 0000000..029a2e9
--- /dev/null
+++ b/src/templates/spamreport-verbose.plain.tt
@@ -0,0 +1,22 @@
+[% IF timespan == 'week' -%]
+[% SET title = "Weekly Spam Report for '${pmail}' - ${date}'" -%]
+[% ELSIF timespan.substr(timespan.length - 1) == 'h' -%]
+[% SET title = "Spam Report (last ${timespan}) for '${pmail}' - ${date}" -%]
+[% ELSE -%]
+[% SET title = "Daily Spam Report for '${pmail}' - ${date}" -%]
+[% END -%]
+subject: [% title %]
+[% IF items.size -%]
+[% items.size %] spam quarantine entries for [% pmail %]:
+
+Manage your spam quarantine: [% managehref %]
+
+[% FOREACH item IN items %]
+- [% item.date %] [% item.time %] From: [% item.from_plain %]
+  Subject: [% item.subject_plain %]
+
+[% END %]
+[% ELSE %]
+No spam entries for the selected period.
+[% END %]
+Powered by Proxmox: https://www.proxmox.com
-- 
2.47.3





More information about the pmg-devel mailing list