Magento – How to send order confirmation email in magento 2 programmatically

emailmagento2

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.

Best Answer

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.