Send order confirmation emails in custom Magento module

I created a custom module in Magento that goes through the whole process from choosing a product, registering a customer and checking with that product. The code for the entire process is executed using the code in the indexcontroller of this module. Everything is done well, but no email is sent for a new order. I thought Magento would automatically send emails to create a new order, even if the process is done programmatically. But this is not the case. Can anyone tell me how can I connect to the default mailings and send emails when an order is placed through a custom module?

I managed to send mail to a new client that generated this line of code right after saving the client:

$customer->sendNewAccountEmail();

      

Does anyone know if there is a code like this for sending a new email? Any help is much appreciated.

+3


source to share


1 answer


Try it. You need to use methods through your order object:



$order->getSendConfirmation(null);
$order->sendNewOrderEmail();

      

+3


source







All Articles