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

Stoiko Ivanov s.ivanov at proxmox.com
Mon Sep 22 13:57:14 CEST 2025


one nit inline:
On Fri, 19 Sep 2025 10:36:21 +0200
Hannes Laimer <h.laimer at proxmox.com> wrote:
>..snip..
> --- /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 %]
for the 2 links I think it might be better to not add the links with [0],
[1] footnotes, but rather inline (in a line of their own).


> 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





More information about the pmg-devel mailing list