From c327ba6e048c983f08fa5ceee966f4517f264946 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 15 Jul 2023 22:47:11 +0200 Subject: [PATCH] Include target mail address in exception msg when PGP encryption fails --- src/MDMailerHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MDMailerHelper.php b/src/MDMailerHelper.php index 612b0d8..213e2ae 100644 --- a/src/MDMailerHelper.php +++ b/src/MDMailerHelper.php @@ -26,14 +26,14 @@ final class MDMailerHelper { $gpg->seterrormode(GNUPG_ERROR_EXCEPTION); if (empty($recipients = $gpg->keyinfo($to))) { - throw new \Exception("Cannot retrieve public key of recipient for GPG encryption"); + throw new \Exception("Cannot retrieve public key of recipient for GPG encryption for mail address: " . $to); } foreach ($recipients as $recipient) { $recipient_fingerprint = $recipient["subkeys"][0]["fingerprint"]; if (empty($recipient = $gpg->addencryptkey($recipient_fingerprint))) { - throw new \Exception("Cannot set public key of recipient for GPG encryption"); + throw new \Exception("Cannot set public key of recipient for GPG encryption for user: " . $to); } }