How to

1. How to add custom block

In this paragraph we will add additional block. Block name will be "custom".

1.1. Create a thumbnail of the block.

The image for a thumbnail of the new block you can download here.custom

Copy the image to this directory:


1.2. Create the block template (.phtml) file

Create new file called custom.phtml here:


The content of file custom.phtml you can download here. Copy it to the file.

1.3. Create block layout file

Create new file called mtemail_custom.xml here:


File content:

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Custom Block" design_abstraction="custom">
        <block class="Magetrend\Email\Block\Email\Block" name="block" template="Magetrend_Email::email/default/block.phtml">
            <block class="Magetrend\Email\Block\Email\Block\Template" name="block.content" template="Magetrend_Email::email/default/block/custom.phtml"/>

1.4. Add this block to the email template

Here for example will be used New Order email template. We will add the block to this template.

Open the file:


After the line:

"layout handle=\"mtemail_footer\" area=\"frontend\" theme=\"default\" template_id=$ block_id=0 block_name=\"mtemail_footer\" noborder=\"1\" ":"mtemail_footer",

insert new block code:

"layout handle=\"mtemail_custom\" area=\"frontend\" theme=\"default\" template_id=$ block_id=0 block_name=\"mtemail_custom\" noborder=\"1\" ":"mtemail_custom",


Clear the cache by running command via ssh:
php -f bin/magento cache:flush