all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports
@ 2025-09-19  8:36 Hannes Laimer
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports Hannes Laimer
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Hannes Laimer @ 2025-09-19  8:36 UTC (permalink / raw)
  To: pmg-devel

This addresses both #1621 and #4023.

https://bugzilla.proxmox.com/show_bug.cgi?id=4023
https://bugzilla.proxmox.com/show_bug.cgi?id=1621

v3, thanks @Stoiko, @Thomas:
 - small helper for decode+utf8-encode
 - restructure verbose spam report template
 - re-add `subject:` line to plain templates

v2, thanks @Thomas:
 - UTF-8 encode plain-text subject/sender/from before using in templates
 - remove `subject:` line from plain template, this is not needed in that
   part of the mail

Hannes Laimer (3):
  pmgqm: add plain subject/from fields for reports
  fix #1621: templates: add plain-text variant of short/verbose spam
    report
  fix #4023: templates: add plain-text variant of admin report

 src/Makefile                              |  3 ++
 src/PMG/CLI/pmgqm.pm                      | 16 +++++--
 src/PMG/Utils.pm                          |  9 ++++
 src/templates/pmgreport.plain.tt          | 51 +++++++++++++++++++++++
 src/templates/spamreport-short.plain.tt   | 17 ++++++++
 src/templates/spamreport-verbose.plain.tt | 22 ++++++++++
 6 files changed, 114 insertions(+), 4 deletions(-)
 create mode 100644 src/templates/pmgreport.plain.tt
 create mode 100644 src/templates/spamreport-short.plain.tt
 create mode 100644 src/templates/spamreport-verbose.plain.tt

-- 
2.47.3



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports
  2025-09-19  8:36 [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports Hannes Laimer
@ 2025-09-19  8:36 ` Hannes Laimer
  2025-09-22 11:54   ` Stoiko Ivanov
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report Hannes Laimer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Hannes Laimer @ 2025-09-19  8:36 UTC (permalink / raw)
  To: pmg-devel

We don't want plain-text reports to contain HTML-escaped chars,
this skips html encoding for the plain-text part.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
v3:
- add small helper for 1522_decode+utf8_encode

 src/PMG/CLI/pmgqm.pm | 16 ++++++++++++----
 src/PMG/Utils.pm     |  9 +++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/PMG/CLI/pmgqm.pm b/src/PMG/CLI/pmgqm.pm
index 41f9f1a..0c30dbe 100755
--- a/src/PMG/CLI/pmgqm.pm
+++ b/src/PMG/CLI/pmgqm.pm
@@ -45,17 +45,25 @@ sub get_item_data {
 
     $item->{id} = sprintf("C%dR%dT%d", $ref->{cid}, $ref->{rid}, $ref->{ticketid});
 
-    $item->{subject} =
-        PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('subject')) || 'No Subject');
+    my $raw_subject = PVE::Tools::trim($head->get('subject')) || 'No Subject';
+    $item->{subject} = PMG::Utils::rfc1522_to_html($raw_subject);
+    $item->{subject_plain} = PMG::Utils::rfc1522_to_plain_utf8($raw_subject);
 
-    my $from = PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('from') // $ref->{sender}));
-    my $sender = PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('sender')));
+    my $raw_from = PVE::Tools::trim($head->get('from') // $ref->{sender});
+    my $from = PMG::Utils::rfc1522_to_html($raw_from);
+    my $from_plain = PMG::Utils::rfc1522_to_plain_utf8($raw_from);
+
+    my $raw_sender = PVE::Tools::trim($head->get('sender'));
+    my $sender = PMG::Utils::rfc1522_to_html($raw_sender);
+    my $sender_plain = PMG::Utils::rfc1522_to_plain_utf8($raw_sender);
 
     if ($sender) {
         $item->{sender} = $sender;
         $item->{from} = sprintf("%s on behalf of %s", $sender, $from);
+        $item->{from_plain} = sprintf("%s on behalf of %s", $sender_plain, $from_plain);
     } else {
         $item->{from} = $from;
+        $item->{from_plain} = $from_plain;
     }
 
     $item->{envelope_sender} = $ref->{sender};
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 3dc909d..4e35aec 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1194,6 +1194,15 @@ sub decode_rfc1522 {
     return $res;
 }
 
+sub rfc1522_to_plain_utf8 {
+    my ($enc) = @_;
+
+    my $res = eval { Encode::encode('UTF-8', decode_rfc1522($enc)) };
+    return $enc if $@;
+
+    return $res;
+}
+
 sub rfc1522_to_html {
     my ($enc) = @_;
 
-- 
2.47.3



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report
  2025-09-19  8:36 [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports Hannes Laimer
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports Hannes Laimer
@ 2025-09-19  8:36 ` Hannes Laimer
  2025-09-22 11:57   ` Stoiko Ivanov
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report Hannes Laimer
  2025-09-22 14:29 ` [pmg-devel] applied: [PATCH pmg-api v3 0/3] add plain-text variants for both reports Thomas Lamprecht
  3 siblings, 1 reply; 8+ messages in thread
From: Hannes Laimer @ 2025-09-19  8:36 UTC (permalink / raw)
  To: pmg-devel

Signed-off-by: Hannes Laimer <h.laimer@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



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report
  2025-09-19  8:36 [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports Hannes Laimer
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports Hannes Laimer
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report Hannes Laimer
@ 2025-09-19  8:36 ` Hannes Laimer
  2025-09-22 11:47   ` Stoiko Ivanov
  2025-09-22 14:29 ` [pmg-devel] applied: [PATCH pmg-api v3 0/3] add plain-text variants for both reports Thomas Lamprecht
  3 siblings, 1 reply; 8+ messages in thread
From: Hannes Laimer @ 2025-09-19  8:36 UTC (permalink / raw)
  To: pmg-devel

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
v3:
- add `subkect:` lien back in

 src/Makefile                     |  1 +
 src/templates/pmgreport.plain.tt | 51 ++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 src/templates/pmgreport.plain.tt

diff --git a/src/Makefile b/src/Makefile
index 54825e2..a554a63 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -26,6 +26,7 @@ CONF_MANS= pmg.conf.5 cluster.conf.5
 TEMPLATES =				\
 	fetchmailrc.tt			\
 	pmgreport.tt			\
+	pmgreport.plain.tt		\
 	spamreport-verbose.tt		\
 	spamreport-verbose.plain.tt	\
 	spamreport-short.tt		\
diff --git a/src/templates/pmgreport.plain.tt b/src/templates/pmgreport.plain.tt
new file mode 100644
index 0000000..a46d20e
--- /dev/null
+++ b/src/templates/pmgreport.plain.tt
@@ -0,0 +1,51 @@
+subject: Proxmox Status Report - [% date %] ([% fqdn %])
+[% IF cluster -%]
+Cluster Status
+[% FOREACH item IN cluster -%]
+- Hostname: [% item.hostname %]
+  IP Address: [% item.ip %]
+  Role: [% item.type %]
+  State: [% item.state %]
+  Load: [% item.loadavg1 %]
+  Memory: [% item.memory %]
+  Disk: [% item.disk %]
+[% IF !loop.last %]----
+[% END %]
+[% END %]
+[% END %]
+[% IF system -%]
+System Status
+[% FOREACH item IN system -%]
+- [% item.text %]: [% item.value %]
+[% END %]
+[% END %]
+[% IF incoming -%]
+Incoming Mails (24 hours)
+[% FOREACH item IN incoming -%]
+- [% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]: [% item.value %]
+[% END %]
+[% END %]
+[% IF outgoing -%]
+Outgoing Mails (24 hours)
+[% FOREACH item IN outgoing -%]
+- [% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]: [% item.value %]
+[% END %]
+[% END %]
+[% IF virusstat -%]
+Virus Charts (Top 10)
+[% FOREACH item IN virusstat -%]
+- [% item.name %]: [% item.count %]
+[% END %]
+[% END %]
+[% IF virusquar -%]
+Virus Quarantine
+[% FOREACH item IN virusquar -%]
+- [% item.text %]: [% item.value %]
+[% END %]
+[% END %]
+[% IF spamquar -%]
+Spam Quarantine
+[% FOREACH item IN spamquar -%]
+- [% item.text %]: [% item.value %]
+[% END %]
+[% END %]
-- 
2.47.3



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report Hannes Laimer
@ 2025-09-22 11:47   ` Stoiko Ivanov
  0 siblings, 0 replies; 8+ messages in thread
From: Stoiko Ivanov @ 2025-09-22 11:47 UTC (permalink / raw)
  To: pmg-devel

Thanks for the iteration and the improvments!

tested this - small nit:

between the 'sections' I get an uneven amount of newlines (depending on
whether there's a FOREACH-loop only or n IF in addition).

It would be nice to remove the superfluous amount - see:
https://template-toolkit.org/docs/manual/Syntax.html#section_Chomping_Whitespace

On Fri, 19 Sep 2025 10:36:22 +0200
Hannes Laimer <h.laimer@proxmox.com> wrote:

> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> v3:
> - add `subkect:` lien back in
> 
>  src/Makefile                     |  1 +
>  src/templates/pmgreport.plain.tt | 51 ++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+)
>  create mode 100644 src/templates/pmgreport.plain.tt
> 
> diff --git a/src/Makefile b/src/Makefile
> index 54825e2..a554a63 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -26,6 +26,7 @@ CONF_MANS= pmg.conf.5 cluster.conf.5
>  TEMPLATES =				\
>  	fetchmailrc.tt			\
>  	pmgreport.tt			\
> +	pmgreport.plain.tt		\
>  	spamreport-verbose.tt		\
>  	spamreport-verbose.plain.tt	\
>  	spamreport-short.tt		\
> diff --git a/src/templates/pmgreport.plain.tt b/src/templates/pmgreport.plain.tt
> new file mode 100644
> index 0000000..a46d20e
> --- /dev/null
> +++ b/src/templates/pmgreport.plain.tt
> @@ -0,0 +1,51 @@
> +subject: Proxmox Status Report - [% date %] ([% fqdn %])
> +[% IF cluster -%]
> +Cluster Status
> +[% FOREACH item IN cluster -%]
> +- Hostname: [% item.hostname %]
> +  IP Address: [% item.ip %]
> +  Role: [% item.type %]
> +  State: [% item.state %]
> +  Load: [% item.loadavg1 %]
> +  Memory: [% item.memory %]
> +  Disk: [% item.disk %]
> +[% IF !loop.last %]----
> +[% END %]
> +[% END %]
> +[% END %]
> +[% IF system -%]
> +System Status
> +[% FOREACH item IN system -%]
> +- [% item.text %]: [% item.value %]
> +[% END %]
> +[% END %]
> +[% IF incoming -%]
> +Incoming Mails (24 hours)
> +[% FOREACH item IN incoming -%]
> +- [% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]: [% item.value %]
> +[% END %]
> +[% END %]
> +[% IF outgoing -%]
> +Outgoing Mails (24 hours)
> +[% FOREACH item IN outgoing -%]
> +- [% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]: [% item.value %]
> +[% END %]
> +[% END %]
> +[% IF virusstat -%]
> +Virus Charts (Top 10)
> +[% FOREACH item IN virusstat -%]
> +- [% item.name %]: [% item.count %]
> +[% END %]
> +[% END %]
> +[% IF virusquar -%]
> +Virus Quarantine
> +[% FOREACH item IN virusquar -%]
> +- [% item.text %]: [% item.value %]
> +[% END %]
> +[% END %]
> +[% IF spamquar -%]
> +Spam Quarantine
> +[% FOREACH item IN spamquar -%]
> +- [% item.text %]: [% item.value %]
> +[% END %]
> +[% END %]



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports Hannes Laimer
@ 2025-09-22 11:54   ` Stoiko Ivanov
  0 siblings, 0 replies; 8+ messages in thread
From: Stoiko Ivanov @ 2025-09-22 11:54 UTC (permalink / raw)
  To: Hannes Laimer; +Cc: pmg-devel

pmail would need a _plain variant as well:

When having mails in quarantine for:
`discard€@test.domain`
the rendered (plaint-text) report says:
`1 spam quarantine entries for discard&euro;@test.domain`


On Fri, 19 Sep 2025 10:36:20 +0200
Hannes Laimer <h.laimer@proxmox.com> wrote:

> We don't want plain-text reports to contain HTML-escaped chars,
> this skips html encoding for the plain-text part.
> 
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> v3:
> - add small helper for 1522_decode+utf8_encode
> 
>  src/PMG/CLI/pmgqm.pm | 16 ++++++++++++----
>  src/PMG/Utils.pm     |  9 +++++++++
>  2 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/src/PMG/CLI/pmgqm.pm b/src/PMG/CLI/pmgqm.pm
> index 41f9f1a..0c30dbe 100755
> --- a/src/PMG/CLI/pmgqm.pm
> +++ b/src/PMG/CLI/pmgqm.pm
> @@ -45,17 +45,25 @@ sub get_item_data {
>  
>      $item->{id} = sprintf("C%dR%dT%d", $ref->{cid}, $ref->{rid}, $ref->{ticketid});
>  
> -    $item->{subject} =
> -        PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('subject')) || 'No Subject');
> +    my $raw_subject = PVE::Tools::trim($head->get('subject')) || 'No Subject';
> +    $item->{subject} = PMG::Utils::rfc1522_to_html($raw_subject);
> +    $item->{subject_plain} = PMG::Utils::rfc1522_to_plain_utf8($raw_subject);
>  
> -    my $from = PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('from') // $ref->{sender}));
> -    my $sender = PMG::Utils::rfc1522_to_html(PVE::Tools::trim($head->get('sender')));
> +    my $raw_from = PVE::Tools::trim($head->get('from') // $ref->{sender});
> +    my $from = PMG::Utils::rfc1522_to_html($raw_from);
> +    my $from_plain = PMG::Utils::rfc1522_to_plain_utf8($raw_from);
> +
> +    my $raw_sender = PVE::Tools::trim($head->get('sender'));
> +    my $sender = PMG::Utils::rfc1522_to_html($raw_sender);
> +    my $sender_plain = PMG::Utils::rfc1522_to_plain_utf8($raw_sender);
>  
>      if ($sender) {
>          $item->{sender} = $sender;
>          $item->{from} = sprintf("%s on behalf of %s", $sender, $from);
> +        $item->{from_plain} = sprintf("%s on behalf of %s", $sender_plain, $from_plain);
>      } else {
>          $item->{from} = $from;
> +        $item->{from_plain} = $from_plain;
>      }
>  
>      $item->{envelope_sender} = $ref->{sender};
> diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
> index 3dc909d..4e35aec 100644
> --- a/src/PMG/Utils.pm
> +++ b/src/PMG/Utils.pm
> @@ -1194,6 +1194,15 @@ sub decode_rfc1522 {
>      return $res;
>  }
>  
> +sub rfc1522_to_plain_utf8 {
> +    my ($enc) = @_;
> +
> +    my $res = eval { Encode::encode('UTF-8', decode_rfc1522($enc)) };
> +    return $enc if $@;
> +
> +    return $res;
> +}
> +
>  sub rfc1522_to_html {
>      my ($enc) = @_;
>  



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report Hannes Laimer
@ 2025-09-22 11:57   ` Stoiko Ivanov
  0 siblings, 0 replies; 8+ messages in thread
From: Stoiko Ivanov @ 2025-09-22 11:57 UTC (permalink / raw)
  To: Hannes Laimer; +Cc: pmg-devel

one nit inline:
On Fri, 19 Sep 2025 10:36:21 +0200
Hannes Laimer <h.laimer@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



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api v3 0/3] add plain-text variants for both reports
  2025-09-19  8:36 [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports Hannes Laimer
                   ` (2 preceding siblings ...)
  2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report Hannes Laimer
@ 2025-09-22 14:29 ` Thomas Lamprecht
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Lamprecht @ 2025-09-22 14:29 UTC (permalink / raw)
  To: pmg-devel, Hannes Laimer

On Fri, 19 Sep 2025 10:36:19 +0200, Hannes Laimer wrote:
> This addresses both #1621 and #4023.
> 
> https://bugzilla.proxmox.com/show_bug.cgi?id=4023
> https://bugzilla.proxmox.com/show_bug.cgi?id=1621
> 
> v3, thanks @Stoiko, @Thomas:
>  - small helper for decode+utf8-encode
>  - restructure verbose spam report template
>  - re-add `subject:` line to plain templates
> 
> [...]

Applied, thanks! The pmail encoding that Stoiko noticed should happen in a
follow up though.

[1/3] pmgqm: add plain subject/from fields for reports
      commit: b6d7c18e4ce2714fbefc6d5954a940fff211238a
[2/3] fix #1621: templates: add plain-text variant of short/verbose spam report
      commit: 87e46b19ff7195c2bbaa2371056d60a0026dbc4d
[3/3] fix #4023: templates: add plain-text variant of admin report
      commit: 3484526a54b2053c8226cea9748c3d90644d319d


_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-09-22 14:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-19  8:36 [pmg-devel] [PATCH pmg-api v3 0/3] add plain-text variants for both reports Hannes Laimer
2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 1/3] pmgqm: add plain subject/from fields for reports Hannes Laimer
2025-09-22 11:54   ` Stoiko Ivanov
2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 2/3] fix #1621: templates: add plain-text variant of short/verbose spam report Hannes Laimer
2025-09-22 11:57   ` Stoiko Ivanov
2025-09-19  8:36 ` [pmg-devel] [PATCH pmg-api v3 3/3] fix #4023: templates: add plain-text variant of admin report Hannes Laimer
2025-09-22 11:47   ` Stoiko Ivanov
2025-09-22 14:29 ` [pmg-devel] applied: [PATCH pmg-api v3 0/3] add plain-text variants for both reports Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal