cancel
Showing results for 
Search instead for 
Did you mean: 

Custom order email send

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Custom order email send

Hello,
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');
$blockObj2->send($orders,true);

 

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