diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index 5c305a02a0490..05fb78ff5151b 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -319,6 +319,16 @@ public function loadDefault($templateId) $modulesDirectory = $this->_filesystem->getDirectoryRead(DirectoryList::MODULES); $templateText = $modulesDirectory->readFile($modulesDirectory->getRelativePath($templateFile)); + /** + * trim copyright message for text templates + */ + if ('html' != $templateType + && preg_match('/^/m', $templateText, $matches) + && strpos($matches[0], 'Copyright') > 0 + ) { + $templateText = str_replace($matches[0], '', $templateText); + } + if (preg_match('//u', $templateText, $matches)) { $this->setTemplateSubject($matches[1]); $templateText = str_replace($matches[0], '', $templateText); @@ -335,9 +345,9 @@ public function loadDefault($templateId) } /** - * Remove comment lines + * Remove comment lines and extra spaces */ - $templateText = preg_replace('#\{\*.*\*\}#suU', '', $templateText); + $templateText = trim(preg_replace('#\{\*.*\*\}#suU', '', $templateText)); $this->setTemplateText($templateText); $this->setId($templateId); diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php index e0ff9f434d4f3..d91575c345a2d 100644 --- a/lib/internal/Magento/Framework/Mail/Message.php +++ b/lib/internal/Magento/Framework/Mail/Message.php @@ -9,6 +9,14 @@ class Message extends \Zend_Mail implements MessageInterface { + /** + * @param string $charset + */ + public function __construct($charset = 'utf-8') + { + parent::__construct($charset); + } + /** * Message type *