I'm getting my custom data from email function and also I'm getting the Product image URL to show it in mail now I tried many ways to show my image in email but its not working for me my custom email code is

    {{template config_path="design/email/header_template"}} 
 <p align="center"><b style="color: #009900">Name:</b> {{trans "%name" name=$name}}</p>
 <p align="center"><b style="color: #009900">Email:</b> {{trans "%email" email=$email}}</p>
 <p align="center"><b style="color: #009900">Phone Number:</b> {{trans "%pnumber" pnumber=$pnumber}}</p>
 <p align="center"><b style="color: #009900">Offer Amount:</b> {{trans "%offeramount" offeramount=$offeramount}}</p>
 <p align="center"><b style="color: #009900">Message:</b> {{trans "%message" message=$message}}</p>
 <p align="center"><b style="color: #009900">Product Name:</b> {{trans "%product_name" product_name=$product_name}}</p>
 <p align="center"><b style="color: #009900">Product Price:</b> {{trans "%product_price" product_price=$product_price}}</p>
 <p align="center"><b style="color: #009900">URL:</b> {{trans '%imgUrl' imgUrl=$imgUrl}}</p>
 <!-- <img src="">{{trans '%imgUrl' imgUrl=$imgUrl}}</img> -->
 <!-- <img src="{{trans '%imgUrl' imgUrl=$imgUrl}}"> -->
 <img src="{{view url='%imgUrl'}}" height="30" width="30" alt="{{trans 'Custom image'}}" />
{{template config_path="design/email/footer_template"}}

In email it shows like enter image description here

so the URL is comming perfectly but in case of img tag when I paste the URL in img src="here" then it is not working how can I set the URL in img src

  • have you tried like this <img src="{view url='%imgUrl'}" height="30" width="30" alt="{{trans 'Custom image'}}" /> – magefms Mar 21 at 9:59
  • Sir how can I use PHP in html file??? – Asad Khan Mar 21 at 10:01
  • Sir <img src="{view url='%imgUrl'}" height="30" width="30" alt="{{trans 'Custom image'}}" /> this is also not working for me – Asad Khan Mar 21 at 10:06
  • I see , this one should hopefully do the trick <img src="{{view url=%imgUrl}}" height="30" width="30" alt="{{trans 'Custom image'}}" /> – magefms Mar 21 at 10:09
  • Sir still not working – Asad Khan Mar 21 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.