Include target mail address in exception msg when PGP encryption fails

This commit is contained in:
Joshua Ramon Enslin 2023-07-15 22:47:11 +02:00
parent df277c27e2
commit c327ba6e04
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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);
}
}