From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 066781FF17B for ; Tue, 1 Oct 2024 15:02:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D1BF937EB2; Tue, 1 Oct 2024 15:03:06 +0200 (CEST) From: Christoph Heiss To: pmg-devel@lists.proxmox.com Date: Tue, 1 Oct 2024 14:59:43 +0200 Message-ID: <20241001125948.605201-1-c.heiss@proxmox.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [quarantine.pm, conf.in, backup-notification.tt, quarantine-link.tt, proxmox.com] Subject: [pmg-devel] [PATCH pmg-api] fix #4211: convert quarantine link mail to template X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" Fixes #4211 [0] by converting the currently hardcoded text for the quarantine link mail to a proper template, enabling users to write their own versions. Pretty straight-forward change. The overall content/wording is kept, only converted to HTML like all other templates. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=4211 Signed-off-by: Christoph Heiss --- src/Makefile | 1 + src/PMG/API2/Quarantine.pm | 19 +++++++------------ src/templates/quarantine-link.tt | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 src/templates/quarantine-link.tt diff --git a/src/Makefile b/src/Makefile index 8e49a10..e268b05 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,6 +44,7 @@ TEMPLATES = \ postgresql.conf.in \ pg_hba.conf.in \ backup-notification.tt \ + quarantine-link.tt \ TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES}) diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm index 9301da9..59b4c9a 100644 --- a/src/PMG/API2/Quarantine.pm +++ b/src/PMG/API2/Quarantine.pm @@ -1235,18 +1235,13 @@ my sub send_link_mail { my $esc_ticket = uri_escape($ticket); my $link = "$protocol_fqdn_port/quarantine?ticket=${esc_ticket}"; - my $text = "Here is your Link for the Spam Quarantine on $fqdn:\n\n$link\n"; - - my $mail = MIME::Entity->build( - Type => "text/plain", - To => $receiver, - From => $mailfrom, - Subject => "Proxmox Mail Gateway - Quarantine Link", - Data => $text, - ); - - # we use an empty envelope sender (we don't want to receive NDRs) - PMG::Utils::reinject_local_mail ($mail, '', [$receiver], undef, $fqdn); + my $tt = PMG::Config::get_template_toolkit(); + my $vars = { + fqdn => $fqdn, + link => $link, + }; + + PMG::Utils::finalize_report($tt, 'quarantine-link.tt', $vars, $mailfrom, $receiver); } __PACKAGE__->register_method ({ diff --git a/src/templates/quarantine-link.tt b/src/templates/quarantine-link.tt new file mode 100644 index 0000000..3cbba1c --- /dev/null +++ b/src/templates/quarantine-link.tt @@ -0,0 +1,14 @@ +[%- SET title = "Proxmox Mail Gateway - Quarantine Link" -%] + + + [% title %] + + +

+ Here is your link for the spam quarantine on [% fqdn %]:

+ Spam quarantine +

+ +

Powered by Proxmox.

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