I am sending order email from my custom module. Issue is in order email it showing debug path hint. Here is the code that i am using.
public function sendEmail($orderdata, $order)
{
/*Send email*/
$this->inlineTranslation->suspend();
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
$sender = [
//'name' => $this->_escaper->escapeHtml($customer->getFirstName()),
//'email' => $this->_escaper->escapeHtml($customer->getEmail()),
'name' => 'My store',
'email' => $this->scopeConfig->getValue('trans_email/ident_general/email', $storeScope)
];
$postObject = new \Magento\Framework\DataObject();
$postObject->setData($orderdata);
$transport = $this->_transportBuilder
->setTemplateIdentifier('7') // Send the ID of Email template which is created in Admin panel
->setTemplateOptions(
[
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
'store' => $this->storeManager->getStore()->getId()
]
)
->setTemplateVars(['order' => $order, 'manufacturerdata' => $orderdata, 'billingaddress' => $orderdata['billingaddress'], 'shippingaddress' => $orderdata['shippingaddress']])
->setFrom($sender)
->addTo($orderdata['brandEmail'])
->getTransport();
$transport->sendMessage();
$this->inlineTranslation->resume();
/**********End Send email*/
}
manufacturer_email_order_items.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Order Items List" design_abstraction="custom">
<update handle="manufactures_email_order_renderers"/>
<!--<update handle="sales_email_item_price"/>-->
<body>
<block class="Magento\Sales\Block\Order\Email\Items" name="items" template="HK_OrderEmail::email/manufacturer_items.phtml" cacheable="false">
<block class="Magento\Framework\View\Element\RendererList" name="manufacturer.email.order.renderers" as="renderer.list"/>
<!--<block class="Magento\Sales\Block\Order\Totals" name="order_totals" template="Magento_Sales::order/totals.phtml">
<arguments>
<argument name="label_properties" xsi:type="string">colspan="2"</argument>
</arguments>
<block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="Magento_Tax::order/tax.phtml">
<action method="setIsPlaneMode">
<argument name="value" xsi:type="string">1</argument>
</action>
</block>
</block>-->
</block>
<block class="Magento\Framework\View\Element\Template" name="additional.product.info" template="Magento_Theme::template.phtml"/>
</body>
</page>
manufactures_email_order_renderers.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
<body>
<referenceBlock name="manufacturer.email.order.renderers">
<block class="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder" as="default" template="HK_OrderEmail::email/items/order/default.phtml"/>
</referenceBlock>
</body>
</page>
Order email template.
{{template config_path="design/email/header_template"}}
<table>
<tr class="email-information">
<td>
<table class="order-details">
<tr>
<td class="address-details">
<h3>{{trans "Billing Info"}}</h3>
<p>{{var billingaddress|raw}}</p>
</td>
{{depend order.getIsNotVirtual()}}
<td class="address-details">
<h3>{{trans "Shipping Info"}}</h3>
<p>{{var shippingaddress|raw}}</p>
</td>
{{/depend}}
</tr>
</table>
{{layout handle="manufacturer_email_order_items" order=$order manufacturerdata=$manufacturerdata area="frontend"}}
</td>
</tr>
</table>
{{template config_path="design/email/footer_template"}}
Here is the email that i am getting with path hint. Path hint is already disabled. I have double checked in DB and also removed cache as well.
Best Answer
I found the problem. When you try to send email by cron, it take by default configs from adminhtml. By default in adminhtml debug email path is always enabled. I use the next functionality for set front area and prevent the problem.