SendEmails.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Cron;
  7. /**
  8. * Sales emails sending observer.
  9. *
  10. * Performs handling of cron jobs related to sending emails to customers
  11. * after creation/modification of Order, Invoice, Shipment or Creditmemo.
  12. */
  13. class SendEmails
  14. {
  15. /**
  16. * Global configuration storage.
  17. *
  18. * @var \Magento\Sales\Model\EmailSenderHandler
  19. */
  20. protected $emailSenderHandler;
  21. /**
  22. * @param \Magento\Sales\Model\EmailSenderHandler $emailSenderHandler
  23. */
  24. public function __construct(\Magento\Sales\Model\EmailSenderHandler $emailSenderHandler)
  25. {
  26. $this->emailSenderHandler = $emailSenderHandler;
  27. }
  28. /**
  29. * Handles asynchronous email sending during corresponding
  30. * cron job.
  31. *
  32. * Also method is used in the next events:
  33. *
  34. * - config_data_sales_email_general_async_sending_disabled
  35. *
  36. * Works only if asynchronous email sending is enabled
  37. * in global settings.
  38. *
  39. * @return void
  40. */
  41. public function execute()
  42. {
  43. $this->emailSenderHandler->sendEmails();
  44. }
  45. }