Showing results for 
Search instead for 
Did you mean: 

Custom order email send

Custom order email send

I'm using Magenoto 2.1 and I have configured custom payment module.My payment proccess
is already done and get the result back from the IPG but I
need to send order email to the customer.I tried to call default email facility that have provided by Magento as bellow


$blockObj= $block->getLayout()->createBlock('Magento\Sales\Model\Order');
$orders= $blockObj->loadByIncrementId($id);

$blockObj2= $block->getLayout()->createBlock('Magento\Sales\Model\Order\Email\Sender\OrderSender');


But this ends with following errors


Notice: Undefined variable: block in

Fatal error: Uncaught Error: Call to a member function getLayout() on null in


What may be the issue how can I pass correct block to use email facility.

Thank you