0

I want to know, which file responsible for sending an email to customer when a shipment is created by admin (IF CHECKED Email Copy of Shipment)

1

You can check this file..

vendor/magento/module-shipping/Controller/Adminhtml/Order/Shipment/Save.php

if (!empty($data['send_email'])) {
    $this->shipmentSender->send($shipment);
}

If Email Copy of Shipment checkbox is selected in Backend and you will try to Submit shipment then this code will send email to customer.

vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php

And in above model file there is send() function available, that will send email to customer.

Hope it will help you!

  • I also want to change the email address of recipient. Can you please tell that? – Avesh Naik Oct 31 at 12:10
  • It means you want to send shipment email to different email, not customer's email ? or something else ? – Kishan Savaliya Oct 31 at 12:15
  • Yes Your Right. – Avesh Naik Oct 31 at 12:23
  • 1
    You can check this file. vendor/magento/module-sales/Model/Order/Email/Sender.php this may be helpful to you. There is one line $this->identityContainer->setCustomerEmail($order->getCustomerEmail()); that set customer's email in prepareTemplate() function. You can add conditions there based on your requirements. – Kishan Savaliya Oct 31 at 12:32
  • 1
    Your right man. Everyone is using this file. – Avesh Naik Oct 31 at 12:47

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.