2

I have made some email templates, i am not much sure where i can add image files & use it in email templates ?

Is their is possible way to get it ?

Please let me know your thoughts on this.

Thankyou

2 Answers 2

6

You can upload images at the module level or theme level inside the web/images folder and use the below code inside the email template for getting these images.

<img src="{{view url='Package_Modulename/images/customimg.png'}}" height="100" width="100" alt="{{trans 'Custom image'}}" />
7
  • I have added image file in app/code/Mod/sales/view/frontend/web/images/order_pickup.png
    – devhs
    Feb 26, 2021 at 12:33
  • Replace "Package_Modulename" with your module name and also replace "customimg.png" with "order_pickup.png".
    – Amit Saini
    Feb 26, 2021 at 12:34
  • Thanks, is this the ideal way to add images ? As i will use it in email templates ?
    – devhs
    Feb 26, 2021 at 12:35
  • Your module name should be "Mod_Sales"
    – Amit Saini
    Feb 26, 2021 at 12:35
  • Yes it is the best way to add images to email templates.
    – Amit Saini
    Feb 26, 2021 at 12:36
1

If you want to use an image from media folder, you can use as below:

<img src="{{media url=&quot;wysiwyg/MyImage.jpg&quot;}}" alt="{{trans 'My Image'}}" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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