[pmg-devel] [PATCH pmg-api 1/2] quarantine: add receiver to delivery/delete log-messages

Stoiko Ivanov s.ivanov at proxmox.com
Thu Jan 30 12:21:39 CET 2025


The question: "What happened to the quarantined e-mail" comes up every
now and then in our support-channels, and it always feels a bit clumsy
to explain how to get to the fitting logline, by referring to the
general timeframe when a user did the request and to look for the
queue-ids and quarantine-file-ids for identifying a particular mail.

Adding the receiver of the mail to the log lines should make this a
bit more straight-forward.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/Quarantine.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/PMG/Quarantine.pm b/src/PMG/Quarantine.pm
index d06a88d..28138ba 100644
--- a/src/PMG/Quarantine.pm
+++ b/src/PMG/Quarantine.pm
@@ -128,12 +128,12 @@ sub deliver_quarantined_mail {
     };
     my $err = $@;
     if ($err) {
-	my $msg = "deliver quarantined mail '$id' ($path) failed: $err";
+	my $msg = "deliver quarantined mail '$id' ($path) to $receiver failed: $err";
 	syslog('err', $msg);
 	die "$msg\n";
     }
 
-    syslog('info', "delivered quarantined mail '$id' ($path)");
+    syslog('info', "delivered quarantined mail '$id' ($path) to $receiver");
 
     return 1;
 }
@@ -141,6 +141,7 @@ sub deliver_quarantined_mail {
 sub delete_quarantined_mail {
     my ($dbh, $ref) = @_;
 
+    my $pmail = $ref->{pmail};
     my $filename = $ref->{file};
     my $spooldir = $PMG::MailQueue::spooldir;
     my $path = "$spooldir/$filename";
@@ -155,12 +156,12 @@ sub delete_quarantined_mail {
 	$sth->finish;
     };
     if (my $err = $@) {
-	my $msg = "delete quarantined mail '$id' ($path) failed: $err";
+	my $msg = "delete quarantined mail '$id' ($path) for $pmail failed: $err";
 	syslog ('err', $msg);
 	die "$msg\n";
     }
 
-    syslog ('info', "marked quarantined mail '$id' as deleted ($path)");
+    syslog ('info', "marked quarantined mail '$id' as deleted ($path) for $pmail");
 
     return 1;
 }
-- 
2.39.5





More information about the pmg-devel mailing list