EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Email body plain fix
Yurii10b923c68b09
diff --git a/application/Espo/Classes/RecordHooks/Email/BeforeSave.php b/application/Espo/Classes/RecordHooks/Email/BeforeSave.phpindex 4ee173a831..d4fa21b1a9 100644--- a/application/Espo/Classes/RecordHooks/Email/BeforeSave.php+++ b/application/Espo/Classes/RecordHooks/Email/BeforeSave.php@@ -55,11 +55,17 @@ class BeforeSave implements SaveHookprivate function processBodyPlain(Email $entity): void{- if (!$entity->isHtml() || !$entity->isAttributeChanged('body')) {+ if (!$entity->isAttributeChanged('body')) {return;}- $body = $entity->getBody();+ $body = $entity->getBody() ?: null;++ if (!$entity->isHtml()) {+ $entity->setBodyPlain($body);++ return;+ }if ($body) {$body = Util::stripHtml($body) ?: null;