1

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

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

step1:

<?php

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;
        parent::__construct($context);   
    }

    public function Emaildata()
    {
        //return current customer ID
        $variables['image_url'] = $this->assetRepo->getUrl(
            'Vendor_Module::images/image.png',
            ['_area' => 'frontend']
        );
    }

    $this->mail(....,$variables)
}

step2:
calling html template image_url

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

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

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.