class MessageEvent
Allows the transformation of a Message and the Envelope before the email is sent.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Contracts\EventDispatcher\Event implements \Psr\EventDispatcher\StoppableEventInterface
- class \Symfony\Component\Mailer\Event\MessageEvent extends \Symfony\Contracts\EventDispatcher\Event
Expanded class hierarchy of MessageEvent
7 files declare their use of MessageEvent
- AbstractTransport.php in vendor/
symfony/ mailer/ Transport/ AbstractTransport.php - EmailIsQueued.php in vendor/
symfony/ mailer/ Test/ Constraint/ EmailIsQueued.php - EnvelopeListener.php in vendor/
symfony/ mailer/ EventListener/ EnvelopeListener.php - Mailer.php in vendor/
symfony/ mailer/ Mailer.php - MessageListener.php in vendor/
symfony/ mailer/ EventListener/ MessageListener.php
File
-
vendor/
symfony/ mailer/ Event/ MessageEvent.php, line 25
Namespace
Symfony\Component\Mailer\EventView source
final class MessageEvent extends Event {
private bool $rejected = false;
/** @var StampInterface[] */
private array $stamps = [];
public function __construct(RawMessage $message, Envelope $envelope, string $transport, bool $queued = false) {
}
public function getMessage() : RawMessage {
return $this->message;
}
public function setMessage(RawMessage $message) : void {
$this->message = $message;
}
public function getEnvelope() : Envelope {
return $this->envelope;
}
public function setEnvelope(Envelope $envelope) : void {
$this->envelope = $envelope;
}
public function getTransport() : string {
return $this->transport;
}
public function isQueued() : bool {
return $this->queued;
}
public function isRejected() : bool {
return $this->rejected;
}
public function reject() : void {
$this->rejected = true;
$this->stopPropagation();
}
public function addStamp(StampInterface $stamp) : void {
if (!$this->queued) {
throw new LogicException(\sprintf('Cannot call "%s()" on a message that is not meant to be queued.', __METHOD__));
}
$this->stamps[] = $stamp;
}
/**
* @return StampInterface[]
*/
public function getStamps() : array {
if (!$this->queued) {
throw new LogicException(\sprintf('Cannot call "%s()" on a message that is not meant to be queued.', __METHOD__));
}
return $this->stamps;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Event::$propagationStopped | private | property | |||
Event::isPropagationStopped | public | function | Is propagation stopped? | Overrides StoppableEventInterface::isPropagationStopped | |
Event::stopPropagation | public | function | Stops the propagation of the event to further event listeners. | 1 | |
MessageEvent::$rejected | private | property | |||
MessageEvent::$stamps | private | property | @var StampInterface[] | ||
MessageEvent::addStamp | public | function | |||
MessageEvent::getEnvelope | public | function | |||
MessageEvent::getMessage | public | function | |||
MessageEvent::getStamps | public | function | |||
MessageEvent::getTransport | public | function | |||
MessageEvent::isQueued | public | function | |||
MessageEvent::isRejected | public | function | |||
MessageEvent::reject | public | function | |||
MessageEvent::setEnvelope | public | function | |||
MessageEvent::setMessage | public | function | |||
MessageEvent::__construct | public | function |