I'm trying to use the transportbuilder to send an custom email in my module. I succeed in sending an email, but the body is always empty.
This is my email_templates.xml (placed in view/frontend/email/)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
<template id="empty_email_template" label="Empty Template" file="empty.html" type="text" module="Xaiamedia_SyncProducts" area="frontend"/>
</config>
And this is my mail function:
$emailTemplateVariables = array();
$emailTempVariables['ucdata'] = 'dummy';
$sendToEmail = '[email protected]';
$postObject = new \Magento\Framework\DataObject();
$postObject->setData($emailTempVariables);
$sender = array('email' => "[email protected]", 'name' => 'Mywebsite');
$transport = $this->_transportBuilder->setTemplateIdentifier('empty_email_template')
->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID])
->setTemplateVars(['data' => $postObject])
->setFrom($sender)
->addTo($sendToEmail)
->setReplyTo($sender['email'])
->getTransport();
$bla = $transport->sendMessage();
And this is my template:
<strong>De volgende producten zijn verwijderd door Lightmakers:</strong> <br><br>
<pre>
{{trans "Ucdata: %ucData" ucData=$data.ucdata}}
</pre>
The email is fully blank (no static template content aswell), but I don't get any error messages while sending. Is there a way to debug this situation?