Hi all,
i have created email template in admin panel i want to send this template with order details programmatically. Please help me on this.
Solved! Go to Solution.
This was just a piece of code explaining how to set email template, as I said, follow this tutorial :
https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/
and you can set your order details in array
$templateVars = [ 'name' => '[FETCH CUSTOMER NAME FROM BILLING ADDRESS]', 'total' => '[FETCH TOTALS FROM BILLING ADDRESS]' ];
and you can pass those variables which can be used in template like below :
{{var name}} {{var total}}
Let us know if it works for you !
Kindly refer below link :
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email.html
It may help you!
Thank you.
Hello @tippanna_pawar
Refer to this blog it shows how to send email programatically by using admin email email template :
https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/
PS : In any email sending code, just pass the email-template-identifier like below :
$this->transportBuilder->setTemplateIdentifier($templateId, $storeScope)
Hope it helps !
but i tried with the below code it is sending empty template without order details..? Can help me in sending order details to it.
This was just a piece of code explaining how to set email template, as I said, follow this tutorial :
https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/
and you can set your order details in array
$templateVars = [ 'name' => '[FETCH CUSTOMER NAME FROM BILLING ADDRESS]', 'total' => '[FETCH TOTALS FROM BILLING ADDRESS]' ];
and you can pass those variables which can be used in template like below :
{{var name}} {{var total}}
Let us know if it works for you !