Skip to content

Commit

Permalink
Fix subject for Send custom email
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmany committed Feb 21, 2020
1 parent 071a6fb commit c3b5cb5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions EventListener/EmailSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,21 @@ public static function getSubscribedEvents()
public function onEmailGenerate(Events\EmailSendEvent $event)
{
$this->logger->info('onEmailGenerate MauticAdvancedTemplatesBundle\EmailSubscriber');
if ($event->getEmail()) {
$subject = $this->templateProcessor->processTemplate($event->getEmail()->getSubject(), $event->getLead());
$event->setSubject($subject);

$content = $this->templateProcessor->processTemplate($event->getEmail()->getCustomHtml(), $event->getLead());
$event->setContent($content);
if ($event->getEmail()) {
$subject = $event->getEmail()->getSubject();
$content = $event->getEmail()->getCustomHtml();
}else{
$content = $this->templateProcessor->processTemplate($event->getContent(), $event->getLead());
$event->setContent($content);
$subject = $event->getSubject();
$content = $event->getContent();
}

$subject = $this->templateProcessor->processTemplate($subject, $event->getLead());
$event->setSubject($subject);

$content = $this->templateProcessor->processTemplate($content, $event->getLead());
$event->setContent($content);


if ( empty( trim($event->getPlainText()) ) ) {
$event->setPlainText( (new PlainTextHelper($content))->getText() );
Expand Down

0 comments on commit c3b5cb5

Please sign in to comment.