Skip to content

Commit

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


$content = $this->templateProcessor->processTemplate($event->getEmail()->getCustomHtml(), $event->getLead());
$event->setContent($content);
if ( empty( trim($event->getPlainText()) ) ) {
$event->setPlainText( (new PlainTextHelper($content))->getText() );
}
Expand Down

0 comments on commit 071a6fb

Please sign in to comment.