BeforeMessageSent.php 718 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Mail\Events;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\Mail\IMessage;
  10. /**
  11. * Emitted before a system mail is sent. It can be used to alter the message.
  12. *
  13. * @since 19.0.0
  14. */
  15. class BeforeMessageSent extends Event {
  16. /** @var IMessage */
  17. private $message;
  18. /**
  19. * @param IMessage $message
  20. * @since 19.0.0
  21. */
  22. public function __construct(IMessage $message) {
  23. parent::__construct();
  24. $this->message = $message;
  25. }
  26. /**
  27. * @return IMessage
  28. * @since 19.0.0
  29. */
  30. public function getMessage(): IMessage {
  31. return $this->message;
  32. }
  33. }