2

I'm using Magento version 2.2.0 to create a custom email template for my custom extension, I need to add inline CSS to the email template, I've followed the instruction here , so my email template file look like this:

<!--@subject Custom E-mail  @-->
<!--@vars {
"var this.getUrl($store, 'admin')":"Warehouse Account URL",
"var customer.email":"Customer Email",
"var customer.name":"Customer Name"
} @-->

{{template config_path="design/email/header_template"}} <!-- pathe of template header-->


{{inlinecss file="css/email-inline.css"}}

<table>
    <tr class="email-intro">
        <td>
            <p class="greeting"> {{trans 'Dear %dear,' dear=$dear |raw}} </p>
        </td>
    </tr>
    <tr class="email-summary">
        <td>
            <p> {{var message |raw}} </p>
        </td>
    </tr>
    <tr class="email-information">
        <td>
            {{var content |raw}}
        </td>
    </tr>
</table>

{{template config_path="design/email/footer_template"}} <!--footer of template-->

My file location for CSS code

app/code/Namespace/Module/view/frontend/web/css/email-inline.less

1

You can get more idea by following below link.

https://gordonlesti.com/magento-2-email-template-style-directives/

Also, do the below commands.

php bin/magento setup:static-content:deploy -f 
php bin/magento setup:upgrade
php bin/magento cache:flush 
0

I am not sure if this step you done or not. But Please run these commands:

php bin/magento setup:static-content:deploy -f 
php bin/magento indexer:reindex 
php bin/magento cache:flush 
php bin/magento cache:clean

I think file is no loaded because of static content was not deployed.

Hope this will help you.

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.