function OriginatorSubscriber::onMessage
Sets the default from header and a sender header if necessary.
Parameters
\Symfony\Component\Mailer\Event\MessageEvent $event: The message event.
File
-
core/
lib/ Drupal/ Core/ Mailer/ EventSubscriber/ OriginatorSubscriber.php, line 31
Class
- OriginatorSubscriber
- Message subscriber which sets the from and sender headers.
Namespace
Drupal\Core\Mailer\EventSubscriberCode
public function onMessage(MessageEvent $event) : void {
$message = $event->getMessage();
if ($message instanceof Email) {
$this->setDefaultFrom($message);
$this->setDefaultSender($message);
$this->removeRedundantSender($message);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.