Skip to main content
29 votes
Accepted

Email template - Order items layout - not appearing

Temp solution is: set in db table: email_template column is_legacy = 1 for this new order email template.
Domagoj Potkoč's user avatar
28 votes
Accepted

Custom Email Header and Footer Template in Magento 2

You can override these templates in your custom theme and edit the html as per your requirement. app/design/frontend/Vendor/themename/Magento_Email/email/header.html app/design/frontend/Vendor/...
Sejal Shah's user avatar
  • 2,141
23 votes

How to render data type html in template email magento2?

I change {{trans "%body" body=$data.body}} to {{trans "%body" body=$data.body|raw}}. it render success.
xanka's user avatar
  • 2,114
22 votes
Accepted

How to add subject in custom email template?

You can write email subject to in your email .html file <!--@subject {{trans "Your Subject Write Here "}} @--> You can pass subject dynamic by follow below example <!--@subject {{trans "...
Suresh Chikani's user avatar
18 votes
Accepted

Pass Variable And Output In Custom Email Template

Try this: $templateOptions = [ 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId() ]; ...
Sagar Dobariya's user avatar
17 votes
Accepted

Magento2 - Command-Line - Sending Email Using Block Templates - Error: Missing required argument $debugHintsPath

I finally found the solution to this problem in the Magento Community Forums, which was provided by @dunagan5887. I decided to share it here on magento.stackexchange.com as many may benefit from a ...
ElGatito's user avatar
  • 890
14 votes
Accepted

Magento 2: How to call CMS Block in email templates?

We can try: {{block class="Magento\\Cms\\Block\\Block" area='frontend' block_id="mail_include_header"}} We can see more how to add a block to email: vendor/magento/module-sales/view/frontend/email/...
Khoa TruongDinh's user avatar
14 votes
Accepted

Get Image Url In Custom Email Template From Theme - Magento2

Code for accessing an image in a theme web/images folder in Magento 2 email template: <img width="180" height="52" src="{{view url='images/email/youtube.jpg'}}" alt="...
LM_Fielding's user avatar
  • 1,533
13 votes
Accepted

Magento 2 custom email template not including header

I had a slightly different problem but i think it would be good to post the solution here anyway as I came across this post when researching my issue. I have a custom module that triggers an email on ...
Frank's user avatar
  • 1,144
12 votes
Accepted

Magento 2: how to declare a custom email template for your module

In Magento 2, you have to declare your custom email templates under the etc/email_templates.xml in your app/code/Vendor/Module folder. Based on the question, a working example would be: <?xml ...
Raphael at Digital Pianism's user avatar
12 votes
Accepted

Magento 2: Email Templates Template Style is not Working

First of all, we need to read here: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/templates/template-email.html#non-inline-styles. For the Non Inline Styles, they must be in a <style ...
Khoa TruongDinh's user avatar
12 votes

Custom Email Header and Footer Template in Magento 2

You can override your core header and footer template into your theme folder, vendor/magento/module-email/view/frontend/email/header.html To your theme, app/design/frontend/{Vendorname}/{thememane}/...
Rakesh Jesadiya's user avatar
11 votes

If Condition with "==" in Email Template {{depend}}

You cannot use logical expressions in depend (unfortunately neither in if as one comment suggested) {{depend X}}...{{/depend}} output content in between only if variable X is true-ish (note that ...
Fabian Schmengler's user avatar
11 votes

How to add tracking url in shipment email for customer in Magento 2?

Please override this file: vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml by creating this path: /app/design/frontend/Custom/theme/Magento_Sales/templates/email/...
Naveen Kumar's user avatar
11 votes
Accepted

How to Change Email Logo in magento 2

Goto Content->Configuration->Click on Edit of first Row->Goto Transactional Email->Logo
Moin Malek's user avatar
10 votes

How to render data type html in template email magento2?

Use |raw with your param variable. example: {{var data|raw}} where data is a param variable that passed to a template and contains a value which is HTML code. data=<html code>
Bhargav Joshi's user avatar
10 votes
Accepted

magento2 send email programmatically without template

Magento 2: The simplest way I found to send a plain text - use Zend1 mail $to = ['[email protected]', '[email protected]']; $email = new \Zend_Mail(); $email->setSubject("Feedback email"); ...
Ravi Soni's user avatar
  • 1,809
9 votes
Accepted

Override model function Magento 2

Depending on what kind of data you want to add, you might want to use an observer instead of rewriting the model: etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/...
Raphael at Digital Pianism's user avatar
9 votes

magento2 send email programmatically without template

Send email programmatically without email template, code is tested in Magento 2.4 /** * @var \Magento\Framework\Mail\MessageInterfaceFactory */ protected $messageInterfaceFactory; /** * @var \...
Avinash Sonune's user avatar
8 votes
Accepted

Magento 2 : How to handle array values in custom email templates?

To loop the values in Email template Step 1: you need to add one layout file in you module. yourmodule/view/frontend/layout/email_product_list.xml <?xml version="1.0"?> <page xmlns:xsi="...
MeenakshiSundaram R's user avatar
7 votes

Magento 2 how to add if or else statement to email template?

The conditonal syntax in email templates is the same as Magento 1. Thus in your email template you can do stuff like this for example: {{if logo_width}} width="{{var logo_width}}" {{else}} ...
Raphael at Digital Pianism's user avatar
7 votes

Magento2 - Command-Line - Sending Email Using Block Templates - Error: Missing required argument $debugHintsPath

As CLI in Magento doesn't have an appropriate area, I figured out the following workaround: app/code/NameSpace/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/...
rut4's user avatar
  • 111
7 votes

Which file hold this layout {{layout handle="sales_email_order_items" order=$order area="frontend"}}

You can update in the file : vendor/magento/module-sales/view/frontend/templates/email/items.phtml Or override in your custom module : app\design\frontend\our-template\default\layout\sales.xml app\...
Magetop E-commerce's user avatar
6 votes

How to render data type html in template email magento2?

Along with {{trans "%body" body=$data.body}} to {{trans "%body" body=$data.body|raw}}. Do remember to change type="text" to type="html" in email_templates.xml, otherwise you'll get plain HTML in ...
Imran Zahoor's user avatar
6 votes

Magento 2: order email does not translate

When an email is sent via cron or from CLI - need to make sure that the Translate Area Part is loaded. For me the following piece of code has helped (I used it right before the email message template ...
Dmytro  Lukachuk's user avatar
6 votes

How to Get order increment id in an email title in Magento 2

you can call like below in email template subject with increment id, {{trans "%increment_id," increment_id=$order.getIncrementId()}}
Rakesh Jesadiya's user avatar
6 votes
Accepted

Magento 2: Send different email templates for Ship, based on Shipping Method chosen

You can create some variables to use in the email template to add some messages based on the shipping method. Add the variables to the template by creating a plugin for Magento\Sales\Model\Order\...
Aaron Allen's user avatar
  • 9,009
6 votes
Accepted

Send transactional email from root folder magento 2

Developed a module for email setup by referring the blog for the requirement: https://webkul.com/blog/magento-2-send-transactional-email-programmatically-in-your-custom-module/ Here I have modified ...
Haritha's user avatar
  • 666
6 votes

Custom Email Header and Footer Template in Magento 2

This setting available in: Content -> Configuration -> Default Store View -> Transactional Emails
Nangyial Ahmad's user avatar
6 votes
Accepted

custom email template is showing header and footer from Luma theme?

I used below code to send mail to customer $templateOptions = array( 'area' => Area::AREA_FRONTEND, 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ); ...
Pandurang Babar's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible