cancel
Showing results for 
Search instead for 
Did you mean: 

transactional emails - where do images go?

SOLVED

transactional emails - where do images go?

I need to add an image (not the logo - got that already) to a transactional email. I can't for the life of me figure out where it goes, how to refer to it in a template, but most importantly, how to get it wherever it is supposed to be located on the server or in the database.

 

In page content the only way I've figured out how to add images is to edit a block, hit the image icon in the WYSIWYG editor, upload the image. The image links the editor creates are broken, but I've figured out how to fix them. I cannot find a way to upload images without editing a block, but at least I found a way to get an image into the content.

 

There is no such editor for transactional emails, as far as I can tell.

 

There is a place to specify a logo. There is no place to upload miscellaneous images, as far as I can tell.

 

Looking at a transactional email that already has images (like, say, the new account email) I see references like this:

 

<img src="{{view url='Magento_Customer/images/icn_checkout.png'}}" height="30" width="30" alt="{{trans 'Quick Checkout'}}" />

 

I cannot find that image anywhere. I see it in four places on the server, in the static content, but I cannot find it anywhere in the admin interface or in any of the image folders accessible through the WYSIWYG editor for content pages.

 

Please. Where do I put images for use in email and how do I reference them in the email templates?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: transactional emails - where do images go?

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 transactional images.

 

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

If you have created plugin then its best way for you otherwise you can set images as per above. 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

4 REPLIES 4

Re: transactional emails - where do images go?

You can find customer module images from Magento's Own custom theme LUMA,

Go to magento 2 root path,

 

vendor/magento/theme-frontend-luma/Magento_Customer/web/images/icn_checkout.png

You can directly find below links in magento 2 repo to get your image path,

 

https://github.com/magento/magento2/tree/2.2-develop/app/design/frontend/Magento/luma/Magento_Custom...

 

You can add your images to Email template by below way,

 

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

You need to Put your image at Package/Modulename/view/frontend/web/images/customimg.png

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: transactional emails - where do images go?

Thank you, Rakesh. Our developer said we could create package & modulename for our organization, or I could duplicate one of the core themes and end up with a place I could put images, either of which could be referenced in the templates as you've described, and I also found that I could put them in pub and use a full url to refer to them in email, but once I had that I ran into the frustration of testing email templates, and I never did resolve a way for marketing to add images without my help. So, I'm currently investigating a plugin that provides WYSIWYG creation of email templates, and most importantly, a way to test them and email them with test data without having to do whatever it is that triggers them, something sorely lacking in magento. The plugin provides an easy way to upload images through the admin interface (and they end up in pub/media/email).

 

THanks.

Re: transactional emails - where do images go?

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 transactional images.

 

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

If you have created plugin then its best way for you otherwise you can set images as per above. 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: transactional emails - where do images go?

Something else to note with Rakesh's response; if you are creating the /view/frontend/web/images directory for a given module that doesn't already exist, you will have to run the upgrade/compile/deploy commands for the code to work with the new directories.