I want to integrate a image in tag as background in style for my account creation email template.

Where can I place this image in my folder and how can I call the image as background.

3 Answers 3


If you don't want to create plugin then you can add your images from module or theme level web/images folder and give the path to your images in email.

<img src="{{view url='Package_Modulename/images/customimg.png'}}" height="30" width="30" alt="{{trans 'Custom image'}}" />

I hope this will help


first you have to set image url in variables like below way..



namespace Vendor\Module\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
    protected $assetRepo;

    public function __construct(
        \Magento\Framework\App\Helper\Context $context,
        \Magento\Framework\View\Asset\Repository $assetRepo
        $this->assetRepo = $assetRepo;

    public function Emaildata()
        //return current customer ID
        $variables['image_url'] = $this->assetRepo->getUrl(
            ['_area' => 'frontend']


calling html template image_url

<img src="{{var image_url}}" width="100px" height="100px">

Go to admin Email template:

Marketing -> Communications -> Email Templates & open email template Ex. New Order

<div class="order-info" style="background: url({{view url='images/order-info.png'}}) center center no-repeat;">

Image folder path will be: app/design/frontend/Vendor_Name/Theme_Name/web/images

I hope it will be work for you also.

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.