3

Admin -> Stores -> Configuration -> Sales -> Sales Email -> Order -> Disabled

Where should I look and which module or modal to send the same email programmatically?

Update

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId);

$emailSender = $objectManager->create('\Magento\Sales\Model\Order\Email\Sender\OrderSender');
$emailSender->send($order);

If I Admin -> Stores -> Configuration -> Sales -> Sales Email -> Order -> Disabled the above code doesn't trigger the email. Or if I enable, it send 2 email. I don't want the email that magento trigger for order confirmation. I want to do it.

  • Hello @iamkdev, it will send admin too? – chirag May 30 '18 at 14:00
3

Look at Magento\Sales\Model\Order\Email\Sender\OrderSender. This is where you'll find the method to send the order confirmation for a given order.

2

I created an around plugin for the send function OrderSender and check my custom condition. Now it works for me.

  • 1
    Can you please share your plugin code? we have same issue. – Rakesh Jesadiya Jul 4 '17 at 13:29
  • 1
    The point of the stackexchange.com is to share information and solutions to the problem. @iamkdev could you please share your code. – knospe Jan 30 '18 at 9:31
  • Hello @iamkdev, it will send admin too? – chirag May 30 '18 at 12:22
  • Adding a comment and not sharing the code how can this be the accepted answer? Atleast show some code to prove it – MadzQuestioning Mar 24 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.