X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=securemail%2Fsecuremail.php;h=115ba47290e2cb2f6d7ed948edb726b33220ce8b;hb=7eb7706a2420f5ee2c2d8d84d1693b101fd80c1e;hp=1ec1aa7b809165279299ffd669a46aba1029416d;hpb=0fb7e2c6470b73fe617abc87ca43f14cb9a9987f;p=friendica-addons.git diff --git a/securemail/securemail.php b/securemail/securemail.php index 1ec1aa7b..115ba472 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -124,6 +124,7 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email) $enable_checked = DI::pConfig()->get($uid, 'securemail', 'enable'); if (!$enable_checked) { + DI::logger()->debug('No securemail enabled.'); return; } @@ -139,6 +140,7 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email) 'format' => 'u', 'filename' => 'encrypted.gpg' ]); + try { $encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data])); $armored_encrypted = wordwrap( @@ -148,10 +150,8 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email) true ); - $email = Friendica\Object\EMail::createFromPrototype($email, [ - 'textVersion' => $armored_encrypted, - 'htmlVersion' => null, - ]); + $email = $email->withMessage($armored_encrypted, null); + } catch (Exception $e) { DI::logger()->warning('Encryption failed.', ['email' => $email, 'exception' => $e]); }