Try to inform user properly when forward/reply failure of encrypted smime message happens

This commit is contained in:
Hadi Nategh 2018-02-07 16:56:39 +01:00
parent 3bbad14683
commit d965fa0f6b

View File

@ -1813,6 +1813,8 @@ class mail_compose
unset($this->sessionData['in-reply-to']);
unset($this->sessionData['to']);
unset($this->sessionData['cc']);
try
{
if(($attachments = $mail_bo->getMessageAttachments($_uid,$_partID,null,true,false,false))) {
//error_log(__METHOD__.__LINE__.':'.array2string($attachments));
foreach($attachments as $attachment) {
@ -1827,6 +1829,16 @@ class mail_compose
}
}
}
catch (Mail\Smime\PassphraseMissing $e)
{
error_log(__METHOD__.'() Failed to forward because of smime '.$e->getMessage());
Framework::message(lang('Forwarding of this message failed'.
' because the content of this message seems to be encrypted'.
' and can not be decrypted properly. If you still wish to'.
' forward content of this encrypted message, you may try'.
' to use forward as attachment instead.'),'error');
}
}
$mail_bo->closeConnection();
if ($_mode)
{
@ -2150,7 +2162,19 @@ class mail_compose
//_debug_array($headers);
//error_log(__METHOD__.__LINE__.'->'.array2string($this->mailPreferences['htmlOptions']));
try {
$bodyParts = $mail_bo->getMessageBody($_uid, ($this->mailPreferences['htmlOptions']?$this->mailPreferences['htmlOptions']:''), $_partID);
}
catch (Mail\Smime\PassphraseMissing $e)
{
$bodyParts = '';
error_log(__METHOD__.'() Failed to reply because of smime '.$e->getMessage());
Framework::message(lang('Replying to this message failed'.
' because the content of this message seems to be encrypted'.
' and can not be decrypted properly. If you still wish to include'.
' content of this encrypted message, you may try to use forward as'.
' attachment instead.'),'error');
}
//_debug_array($bodyParts);
$styles = Mail::getStyles($bodyParts);