When developing the module I encountered the following problem: inside the my controller (class Index extends \Magento\Framework\App\Action\Action) there is a method that calls a method to send email send() (inside class EmailSenderResultsSync extends AbstractHelper).

E-mail is sent and works well until the template file (view/frontend/email/sync-report/index.html) contains only html code, for example:


But when I try to insert a block in the template as follows:

{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='<vendor>_<module>::email/sync-report/test.phtml' }}

an email is sent (along with the contents of the block) only 1 time. The next time you contact the controller (class Index extends \Magento\Framework\App\Action\Action), it does not work. The controller does not perform any actions at all.

There is no information in the logs.

I hope for help, thank you!


You cannot call block like this in email template.

Here You have allowed customization for magento 2: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/templates/template-email.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.