Skip to main content
33 votes
Accepted

How to send an email programmatically in Magento 2?

/** * Recipient email config path */ const XML_PATH_EMAIL_RECIPIENT = 'contact/email/recipient_email'; /** * @var \Magento\Framework\Mail\Template\TransportBuilder */ protected $_transportBuilder; /**...
Anil Singh's user avatar
20 votes
Accepted

Magento2 cannot load some transaction emails

This is a bug in Magento 2 and here is the solution: https://github.com/magento/magento2/pull/5116/files This will fixed the invalid json objects in the order email templates. See this on vendor/...
nhinzky's user avatar
  • 709
11 votes
Accepted

Why does Magento 2 suspend inline translation while sending a transactional email?

Inline translation is disabled when sending an email because, when inline translation is active, any translatable printed text (__('Text here')) goes through Magento\Framework\Phrase\RendererMagento\...
Marius's user avatar
  • 198k
9 votes

Magento 2 - How to add custom block/template to transactional mail?

We can do like this: {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Vendor_Module::email/custom.phtml'}} See more here: vendor/magento/module-sales/view/...
Khoa TruongDinh's user avatar
8 votes

How to add customers email to transactional emails content

I'll leave you here several variables in case you need them: - For registration: {{var customer}} Will print out all customer information {{var customer.ID}} {{var customer.email}} {{var customer....
alxh28's user avatar
  • 81
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
6 votes
Accepted

Magento 2 : How to solve the special characters in email subject?

Using this reference on the Magento 2 Repository in Github, you can create a plugin to fix like that: di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Rafael Corrêa Gomes's user avatar
6 votes
Accepted

How to send different order emails to admin and customer in magento 2

You may try pre-made extensions like: https://www.hiddentechies.com/new-order-notification-magento-2.html (Free) https://codecanyon.net/item/magento-2-new-order-notification/19237122 (Paid) or you ...
Mohit Kumar Arora's user avatar
5 votes

custom transactional email special characters issue

I managed to find a solution by using Zend Mail : $mail = new Zend_Mail('UTF-8'); $mail->setType(Zend_Mime::MULTIPART_RELATED); $mail->setBodyHtml($processedTemplate); $mail->setFrom($...
Alexglvr's user avatar
  • 1,675
4 votes

Is there a way to add foreach loop in email template?

Actually you can use a for loop in emails. I've tested it on 2.3.3 version. This is the code location to inspect. This is how it looks like in the template: <ul> {{for item in data.items}} ...
augsteyer's user avatar
  • 271
4 votes
Accepted

How to add new column and custom attribute in order email template in Magento 1.9.3?

Consideration:code of custom attribute is custom Note: Please do not edit core files, Copy below files to your Theme First we need to add a column to template: file path:app\design\frontend\rwd\...
Pawan's user avatar
  • 5,906
4 votes
Accepted

How to send Transaction email from controller in Magento 2

it's working for me $emailTemplateVariables = array(); $emailTempVariables['myvar'] = $myvar; $senderName = 'test'; $senderEmail = '[email protected]'; $...
Rv Singh's user avatar
  • 1,627
4 votes

Customer name missing in transaction mail in 2.4.6?

{{trans "%customer_name," customer_name=$order.getCustomerName()}} Change this line to: {{trans "%customer_name," customer_name=$order_data.customer_name}} Additionally, remove ...
Pruthvi Raval's user avatar
3 votes

Magento 2: Update order emails

how to send update mail in magento public function __construct( .... \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\ObjectManagerInterface $objectManager, .... ) { .... $...
Surendra Kumar Ahir's user avatar
3 votes
Accepted

How to add new Template Variable in magento

Template variables are comes from email template comments, To add new template variable we need to add it to email template comment section(at top of email template html) as like below: <!--@...
Ranjit Shinde's user avatar
3 votes

Why does Magento 2 suspend inline translation while sending a transactional email?

When in-line translation is allowed public function string will translated accordingly. So you need disable it and resume later. This also prevent issues with improperly enabled inline translation. ...
BartZalas's user avatar
  • 1,757
3 votes
Accepted

Magento 2 : Transaction mail Logo And Footer Default Links

please check the path vendor/magento/theme-frontend-luma/Magento_Email/email/foot‌​er.html vendor/magento/module-email/view/frontend/email/header.html
Nikhil waghela's user avatar
3 votes

Magento 2 - Html Tags in Comment Section of Transactional E-Mails

By default Magento does not allow html tags in the order comments. It's in the controller that handles the comments. Take a look in vendor/magento/module-sales/Controller/Adminhtml/Order/AddComment....
Sejal Shah's user avatar
  • 2,153
3 votes
Accepted

Magento 1.9 check if order got shipment

Try using below code to check if the order has shipped. <?php $hasShipment = $this->getOrder()->getShipmentsCollection()->count(); if($hasShipment){ .... // Do your stuff } ?>
Jaimin Sutariya's user avatar
3 votes

Getting the shipping method code in transactional emails

Not sure I follow 100%, but I'll take a shot at it. {{var shippingMethod}} is not a standard variable on sales email templates, so it must be something you already inject as custom. Default ...
Rick Buczynski's user avatar
3 votes
Accepted

Getting wrong footer for custom transactionl email

Since running cronjobs, the store is set to the admin one and when it comes to sending transactional emails , it doesn't knows about stores, so I include my code between a store emulation: $...
Attila Naghi's user avatar
  • 4,033
3 votes
Accepted

M2: How to add store address to transactional email / invoice email?

This is from Magento development docs The selection of available variables depends on which template you use as a basis. The template-specific variables are contained in a comment at the top of each ...
BartZalas's user avatar
  • 1,757
3 votes
Accepted

How to send sales transaction emails?

For that you have to use event sales_order_state_change_before and check previous state/status and current state/status. According to this pass data in template variable and use in email template. &...
Ketan Borada's user avatar
  • 2,623
3 votes
Accepted

Magento 2 : create newsletter subscription CMS page

You can create new CMS page from Admin->Content->Pages->Add New Page Page Title = Newsletter /*As you want*/ Content Heading = Subscribe to our Newsletter /*As you want*/ Then add the below ...
Kishor Thummar's user avatar
3 votes
Accepted

Magento 2.3: My layout handle is not working in email template

learn about system.xml click here link-1 and Link-2 I follow Magento Default way to send email. app\code\VendorName\RequestForQuote\etc\adminhtml system.xml <?xml version="1.0"?> <config ...
Msquare's user avatar
  • 9,173
3 votes
Accepted

Magento 2 - Transactional E-Mail Template location

All transactional email templates are stored in the email directory of Magento_Sales module. If you have installed Magento through composer, then below is the directory to look for. vendor/magento/...
Zeeshan Khuwaja's user avatar
3 votes
Accepted

How to set reply-to-email-address for transactional emails in Magento 2.4?

To add a reply-to email address programmatically for all transactional emails in Magento 2.4, you can create a custom module to extend the email functionality. Follow these steps to create the module: ...
brentwpeterson's user avatar
2 votes

Magento Transactional email template header and footer not loading

you need to change mail header template form System > configuration > design > Transnational Emails
Abdelrahman El Awadi's user avatar
2 votes

How to style transactional email with email-inline.css

What i did was adding {{var non_inline_styles}} on template content and then i added all my styles on the template styles.
nick kladis's user avatar
2 votes

Magento Newsletter Subscription Confirmation Succesful not sent

Klettseb's solution should work, but I'd recommend a lighter approach instead of overriding the entire Subscriber class: \app\etc\modules\Yourcompany_Newsletter.xml <?xml version="1.0"?> &...
kmdsax's user avatar
  • 562

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