Magento2- Send custom transactional emails
okie bit of debugging helps,
Sending a transactional email in Magento2
class Dummy
{
/**
* @var \Magento\Framework\Mail\Template\TransportBuilder
*/
private $_transportBuilder;
public function __construct( \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder){
$this->_transportBuilder = $transportBuilder;
}
public function sendEmail($templateId =1, $storeId =1,$templateParams)
{
$transport = $this->_transportBuilder->setTemplateIdentifier($templateId)
->setTemplateOptions(['area' => Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId])
->setTemplateVars($templateParams)
->setFrom('[email protected]')
->addTo('[email protected]')
->setReplyTo('[email protected]')
->addBcc('[email protected]')
->getTransport();
$transport->sendMessage();
}
}