public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 2/2] utils: finalize_report: change order of plain and html parts
Date: Mon, 13 Oct 2025 13:06:19 +0200	[thread overview]
Message-ID: <20251013110719.18486-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20251013110719.18486-1-s.ivanov@proxmox.com>

After 2 reports and a hint in our community forum [0] that the reports
are displayed differently since the upgrade - I checked the MIME-RFC:
https://datatracker.ietf.org/doc/html/rfc2046#section-5.1.4

which suggests to add the most preferred alternative last (so that
text/plain comes in the beginning which is nicer to view for
mail-clients which do not handle MIME at all).

I had chalked this up to my MUAs preferring text/plain where possible.

Tested this by comparing a spamreport sent with this patch applied in
* claws-mail
* mutt
* bluemind webmail
* aerc

[0] https://forum.proxmox.com/threads/.173435/
Fixes: 542f7279 ("utils: allow specifying plain and/or html for finalize_report()")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/Utils.pm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index a2cd3fc4..52b98c01 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1370,13 +1370,6 @@ sub finalize_report {
         Subject => bencode_header(decode_entities($title)),
     );
 
-    if ($html) {
-        $top->attach(
-            Data => $html,
-            Type => "text/html",
-            Encoding => $debug ? 'binary' : 'quoted-printable',
-        );
-    }
     if ($plaintext) {
         $top->attach(
             Data => $plaintext,
@@ -1384,6 +1377,13 @@ sub finalize_report {
             Encoding => '8-bit',
         );
     }
+    if ($html) {
+        $top->attach(
+            Data => $html,
+            Type => "text/html",
+            Encoding => $debug ? 'binary' : 'quoted-printable',
+        );
+    }
 
     $top->head()->add('Auto-Submitted', 'auto-generated');
 
-- 
2.47.3



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


  parent reply	other threads:[~2025-10-13 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 11:06 [pmg-devel] [PATCH pmg-api 0/2] fix 2 issues with spamreports and quarantine Stoiko Ivanov
2025-10-13 11:06 ` [pmg-devel] [PATCH pmg-api 1/2] api: quarantine: fix wrong backward-compatibility action Stoiko Ivanov
2025-10-13 11:06 ` Stoiko Ivanov [this message]
2025-10-13 14:24 ` [pmg-devel] [PATCH pmg-api 0/2] fix 2 issues with spamreports and quarantine Dominik Csapak
2025-10-13 15:09 ` [pmg-devel] applied-series: " Stoiko Ivanov
2025-10-13 16:36 ` [pmg-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251013110719.18486-3-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal