In magento2 send email with contact module use:
$transport = $this->_transportBuilder
->setTemplateIdentifier($this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, $storeScope))
->setTemplateOptions(
[
'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
]
)
->setTemplateVars(['data' => $postObject])
->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
->addTo($this->scopeConfig->getValue(self::XML_PATH_EMAIL_RECIPIENT, $storeScope))
->setReplyTo($post['email'])
->getTransport();
$transport->sendMessage();
So i have create custom send email it not have template. but i don't know how do send email with transportBuilder is true.
this's data i want send.
$myData = Array (
[to] => [email protected]
[email] => [email protected]
[subject] => Magento Commerce
[headers] => array(
[reply_to] => [email protected]
)
[body] => {{template config_path="design/email/header_template"}}
{{depend Magento Commerce}} Magento Commerce {{/depend}}
Name: ABC
Email: [email protected]
Subject: Magento Commerce
Message: Sample text.
{{template config_path="design/email/footer_template"}}
[type] => text/html
[attachments] =>
)
How do i can send email with $myData use transportBuilder. Many thank!!