Mail - Also include HTML version of email in integration data (for apps that can handle it)

This commit is contained in:
nathangray
2017-11-08 13:09:31 -07:00
parent aaa0d729fb
commit 7c65127e64
3 changed files with 89 additions and 15 deletions

View File

@@ -6203,7 +6203,7 @@ class Mail
* @param uid the uid of the email to be processed
* @param partid the partid of the email
* @param mailbox the mailbox, that holds the message
* @param preserveHTML flag to pass through to getdisplayableBody
* @param preserveHTML flag to pass through to getdisplayableBody, null for both text and HTML
* @param addHeaderSection flag to be able to supress headersection
* @param includeAttachments flag to be able to supress possible attachments
* @return array/bool with 'mailaddress'=>$mailaddress,
@@ -6219,6 +6219,15 @@ class Mail
if (empty($headers)) return false;
// dont force retrieval of the textpart, let mailClass preferences decide
$bodyParts = $mailClass->getMessageBody($uid,($preserveHTML?'always_display':'only_if_no_text'),$partid,null,false,$mailbox);
if(is_null($preserveHTML))
{
$html = static::getdisplayablebody(
$mailClass,
$mailClass->getMessageBody($uid,'always_display',$partid,null,false,$mailbox),
true
);
}
// if we do not want HTML but there is no TextRepresentation with the message itself, try converting
if ( !$preserveHTML && $bodyParts[0]['mimeType']=='text/html')
{
@@ -6316,13 +6325,19 @@ class Mail
}
if (is_array($attachedMessages)) $attachments = array_merge($attachments,$attachedMessages);
}
return array(
$return = array(
'mailaddress'=>$mailaddress,
'subject'=>$subject,
'message'=>$message,
'attachments'=>$attachments,
'headers'=>$headers,
);
);
if($html)
{
$return['html_message'] = $html;
}
return $return;
}
/**