Logicify/mautic-advanced-templates-bundle

Plugin broke emojis in emails

Opened this issue ยท 5 comments

jenya commented

When plugin is enabled emojis doesn't work correctly in all emails - no matter is there {% TWIG_BLOCK %} in it or no.
Emojis are visible in email builder and preview ๐Ÿ€ but in sent emails it shows as :four_leaf_clover:
Removing plugin fix this.
Mautic v4.4.6

This seems like a simple fix, Ill have a look at this. Thank you for providing this information.

@jenya

To temporarily fix the issue, you can comment out the lines of code causing the problem. The lines in question can be found at the following link: https://github.com/Logicify/mautic-advanced-templates-bundle/blob/675c2577b462dd5f25646c0bc2cb13c500299802/EventListener/EmailSubscriber.php#LL119C1-L120C38

Simply add two forward slashes in front of each line, like so:

// $subject = $this->templateProcessor->processTemplate($props['subject'],  $lead);
// $event->setSubject($subject);

This will temporarily disable those lines of code and allow the program to work as intended. Keep in mind that this is just a temporary fix and after that twig template won't be applied to the subject.

we are facing the same issue. The "ยฉ" symbol in the email body is not displaying correctly and instead appears as ":copyright:". Surprisingly, this issue is only prevalent when emails are sent through a campaign, while it functions properly when sent directly to a contact.

I have found the solution:

Inside the file:
/EventListener/EmailSubscriber.php

add on line 14:

use Psr\Log\LoggerInterface;
use Monolog\Logger;
use Mautic\CoreBundle\Helper\EmojiHelper; /* enable Emoji - add needed reference */

/**
 * Class EmailSubscriber.
 */
class EmailSubscriber implements EventSubscriberInterface

and on line 121 and 126:

        $subject = $this->templateProcessor->processTemplate($props['subject'],  $lead);
        $subject = EmojiHelper::toEmoji($subject, 'short'); /* enable Emoji in Subject - add this line */
        $event->setSubject($subject);

        $content = $this->templateProcessor->processTemplate($props['content'],  $lead, $props['tokens']);
        $content = $this->templateProcessor->addTrackingPixel($content);
        $content = EmojiHelper::toEmoji($content, 'short'); /* enable Emoji in Content- add this line */
        $event->setContent($content);

I do not know how to add a PR for this change... if someone would be so kind to add the PR to implement the changes :)

corvis commented

@MarketSmart can you take a look please?