mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 12:03:46 +00:00
Merge pull request #953 from nupplaphil/bug/8206-securemail
[securemail] Fix secure Mail addon
This commit is contained in:
commit
f416f4d6a4
1 changed files with 4 additions and 4 deletions
|
@ -124,6 +124,7 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email)
|
||||||
|
|
||||||
$enable_checked = DI::pConfig()->get($uid, 'securemail', 'enable');
|
$enable_checked = DI::pConfig()->get($uid, 'securemail', 'enable');
|
||||||
if (!$enable_checked) {
|
if (!$enable_checked) {
|
||||||
|
DI::logger()->debug('No securemail enabled.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +140,7 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email)
|
||||||
'format' => 'u',
|
'format' => 'u',
|
||||||
'filename' => 'encrypted.gpg'
|
'filename' => 'encrypted.gpg'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data]));
|
$encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data]));
|
||||||
$armored_encrypted = wordwrap(
|
$armored_encrypted = wordwrap(
|
||||||
|
@ -148,10 +150,8 @@ function securemail_emailer_send_prepare(App &$a, IEmail &$email)
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$email = Friendica\Object\EMail::createFromPrototype($email, [
|
$email = $email->withMessage($armored_encrypted, null);
|
||||||
'textVersion' => $armored_encrypted,
|
|
||||||
'htmlVersion' => null,
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
DI::logger()->warning('Encryption failed.', ['email' => $email, 'exception' => $e]);
|
DI::logger()->warning('Encryption failed.', ['email' => $email, 'exception' => $e]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue