Project

General

Profile

Bug #93992

Updated by Mathias Brodala almost 3 years ago

In TYPO3 10LTS (current version 10.4.15) there is a bug in the ext "form" that causes html emails to be sent with the plaintext template.  

 General setup:  

 - @useFluidEmail@: useFluidEmail -> FALSE 
 - @addHtmlPart@: addHtmlPart -> TRUE 
 - @templatePathAndFilename@: templatePathAndFilename -> path set including @{@format}@ "{@format}" wildcard 

 Bug:  

 With this setup @initializeStandaloneView()@ "initializeStandaloneView" gets called twice. Once for the plaintext part and once for the html part. 

 <pre><code class="php"> 
         if (isset($this->options['templatePathAndFilename'])) { 
             $this->options['templatePathAndFilename'] = strtr($this->options['templatePathAndFilename'], [ 
                 '{@format}' => $format 
             ]); 
             $standaloneView->setTemplatePathAndFilename($this->options['templatePathAndFilename']); 
 </code></pre> 

 This code snippet from line 215 sets @$this->options['templatePathAndFilename']@ "$this->options['templatePathAndFilename']" and overrides the @{@format}@ "{@format}" with @Plaintext@. "Plaintext". On the second run (html part) the wildcard is already replaced so the html email gets the same template like the plaintext email.  

 This is incorrect and a bug. 

 The error is introduced in 10LTS and was a regression from 9LTS since in 9LTS only a plaintext OR html email could be sent not both.  

 A simple fix would be:  

 <pre><code class="php"> 
         if (isset($this->options['templatePathAndFilename'])) { 
             $templatePathAndFilename = strtr($this->options['templatePathAndFilename'], [ 
                 '{@format}' => $format, $format 
             ]); 
             $standaloneView->setTemplatePathAndFilename($templatePathAndFilename); 
         } 
 </code></pre> 

Back