5

By default, when a customer buys something on my website (Magento 1.9) he receives an order confirmation via email. The thing is I'm using another platform to send my emails to the customer. So I don't want magento to send emails to the customer. I want to be the only one (the admin) notified when someone buys something.

So how can I make magento to send order email only to the admin and not the customer ? Maybe I have to modify some files, but I dont know which one...

I really need some help. Thank you !

4 Answers 4

4

New order email are sent when the method Mage/Sales/Model/Order.php:queueNewOrderEmail is called.

If you look this method, you will see that there is a configuration setting sales_email/order/enabled to enable/disable this email but it seems that you don't want to disable it.

To modify the destination email, I guess you will have to rewrite the Mage/Sales/Model/Order.php and its method queueNewOrderEmail.

In your rewritten method, you will have to replace $emailInfo->addTo($this->getCustomerEmail(), $customerName); by $emailInfo->addTo(<the-email-you-want>, <the-name-you-want>);.

Hope it helps.

2
  • I think we are getting close to the solution, but unfortunately it is not working. The emails are still being sent to the customer...
    – Steeve
    Commented Mar 9, 2018 at 17:12
  • Do you have any other idea @Julien ?
    – Steeve
    Commented Mar 15, 2018 at 23:02
0

simply go to your magento admin panel >> system >> configuration >> sales >> transactions emails >> order >> set to unable. This way, the system will not shoot an emails after a new order is processed. Do the same for other stuffs like order updated and so

1
  • Its not the right solution because no emails will be sent not even to the admin. And I want to be the only one notified when someone place an order
    – Steeve
    Commented Mar 9, 2018 at 17:12
0

I have the same question but for Magento 2.x? I'd like to send order email to admin, preferably without changing core files. Any one got ideas on this?

0

for magento 2.4, use prefernce in di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Model\Order\Email\Sender\OrderSender" type="Vendor\Module\Model\Order\Email\Sender\OrderSender" />
</config>

after prepareTemplate, update customer email with admin email

<?PHP

namespace Vendor\Module\Model\Order\Email\Sender;

use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Email\SenderBuilder;

class OrderSender extends \Magento\Sales\Model\Order\Email\Sender\OrderSender
{
protected function checkAndSend(Order $order)
{
    $this->identityContainer->setStore($order->getStore());
    if (!$this->identityContainer->isEnabled()) {
        return false;
    }
    $this->prepareTemplate($order);

    //could local admin email address from backend config
    $this->identityContainer->setCustomerEmail('ADMIN_EMAIL_ADDRESS');

    /** @var SenderBuilder $sender */
    $sender = $this->getSender();

    try {
        $sender->send();
    } catch (\Exception $e) {
        $this->logger->error($e->getMessage());
        return false;
    }
    if ($this->identityContainer->getCopyMethod() == 'copy') {
        try {
            $sender->sendCopyTo();
        } catch (\Exception $e) {
            $this->logger->error($e->getMessage());
        }
    }
    return true;
}
}

Your Answer

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

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