Deprecated: Return type of Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 256

Deprecated: Return type of Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 261

Deprecated: Return type of Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 268

Deprecated: Return type of Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 278

Deprecated: Return type of Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 22

Deprecated: Return type of Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 38

Deprecated: Return type of Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 30

Deprecated: Return type of Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 43

Deprecated: Return type of Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 14

Deprecated: Return type of Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 49
Symfony Profiler

vendor/symfony/mailer/EventListener/EnvelopeListener.php line 43

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Mailer\EventListener;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\Mailer\Event\MessageEvent;
  13. use Symfony\Component\Mime\Address;
  14. use Symfony\Component\Mime\Message;
  15. /**
  16.  * Manipulates the Envelope of a Message.
  17.  *
  18.  * @author Fabien Potencier <fabien@symfony.com>
  19.  */
  20. class EnvelopeListener implements EventSubscriberInterface
  21. {
  22.     private $sender;
  23.     private $recipients;
  24.     /**
  25.      * @param Address|string     $sender
  26.      * @param (Address|string)[] $recipients
  27.      */
  28.     public function __construct($sender null, array $recipients null)
  29.     {
  30.         if (null !== $sender) {
  31.             $this->sender Address::create($sender);
  32.         }
  33.         if (null !== $recipients) {
  34.             $this->recipients Address::createArray($recipients);
  35.         }
  36.     }
  37.     public function onMessage(MessageEvent $event): void
  38.     {
  39.         if ($this->sender) {
  40.             $event->getEnvelope()->setSender($this->sender);
  41.             $message $event->getMessage();
  42.             if ($message instanceof Message) {
  43.                 if (!$message->getHeaders()->has('Sender') && !$message->getHeaders()->has('From')) {
  44.                     $message->getHeaders()->addMailboxHeader('Sender'$this->sender->getAddress());
  45.                 }
  46.             }
  47.         }
  48.         if ($this->recipients) {
  49.             $event->getEnvelope()->setRecipients($this->recipients);
  50.         }
  51.     }
  52.     public static function getSubscribedEvents()
  53.     {
  54.         return [
  55.             // should be the last one to allow header changes by other listeners first
  56.             MessageEvent::class => ['onMessage', -255],
  57.         ];
  58.     }
  59. }