0

How can I send order confirmation emails to the customers, who have completed orders from the front end? I know by default Magento sends transactional email when any new order is placed, but what I want is to have an option in bulk operation to send order email from sales -> order grid admin panel.

2 Answers 2

0

https://github.com/magevision/magento2-mass-email-customers

I know add a 3rd party link on stackoverflow is not good idea but this extension will help you :)

3
  • Thank you I already using looked this extension, but this extension only sends some static general emails, But I want with order details of each particular order.
    – ishaq
    Aug 28, 2021 at 11:31
  • you can edit "Controller/Adminhtml/Email/MassSend.php" Send() function as per your need Aug 28, 2021 at 13:18
  • I posted below answer you just need to add code in foreach for send email Aug 28, 2021 at 13:19
0
<?php

declare(strict_types=1);

namespace Class\Where\You\Want\Custom\OrderSender;

use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;

class Test {
    /**
     * @var OrderRepositoryInterface
     */
    private OrderRepositoryInterface $orderRepository;
    
    /**
     * @var OrderSender
     */
    private OrderSender $orderSender;

    /**
     * Index constructor.
     *
     * @param OrderRepositoryInterface $orderRepository
     * @param OrderSender $orderSender
     */
    public function __construct(
        OrderRepositoryInterface $orderRepository,
        OrderSender $orderSender
    ) {
        $this->orderRepository = $orderRepository;
        $this->orderSender = $orderSender;
    }

    public function someFunction() {
        $order = $this->orderRepository->get(8); // Your logic to get the order
        $this->orderSender->send($order); // Order sender has custom identity that ignores settings
    }
}

or using objectmanager (just for knowledge. Using objectmanager is bad practice)

$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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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