Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin broke emojis in emails #32

Open
jenya opened this issue Mar 28, 2023 · 5 comments
Open

Plugin broke emojis in emails #32

jenya opened this issue Mar 28, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jenya
Copy link

jenya commented Mar 28, 2023

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

@MarketSmart MarketSmart added the bug Something isn't working label Mar 28, 2023
@MarketSmart
Copy link
Collaborator

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

@imlolman
Copy link

imlolman commented Apr 9, 2023

@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.

@robertvy
Copy link

robertvy commented Aug 2, 2023

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.

@IonutOjicaDE
Copy link

IonutOjicaDE commented Sep 13, 2023

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
Copy link
Member

corvis commented Sep 13, 2023

@MarketSmart can you take a look please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants