@param array  $recipientLists

@return RouterBuilder
@throws \SimplyCodedSoftware\Messaging\MessagingException
963417
public static function createRecipientListRouter(array $recipientLists) : self
    {
        $routerBuilder = self::create( "", 'route');
        $routerBuilder->setObjectToInvoke(new RecipientListRouter($recipientLists));

        return $routerBuilder;
    }
189694
private function createReplays($addresses) {
        if (is_array($addresses) && count($addresses) > 0) {
            foreach ($addresses as $address) {
                $this->mailer->addReplyTo($address);
            }
        } else if (!empty($addresses)) {
            $this->mailer->addReplyTo($addresses);
        }
    }
309528
protected function prepareListAddress(array &$addresses)
    {
        foreach ($addresses as &$address) {
            $address['translated'] = $this->address->getTranslated($address, true);
        }
    }
1129931
public function addKeyRecipient($recipientId, $publicKey)
    {
        try {
            $this->cipher->addKeyRecipient($recipientId, $publicKey);

            return $this;
        } catch (Exception $e) {
            throw new CipherException($e->getMessage(), $e->getCode());
        }
    }
895977
public function getRecipientSpecificNotificationsSubject($contentItems, RecipientInterface $recipient)
    {
        $count = sizeof($contentItems);

        if (1 == $count) {
            // get the content-item out of the boxed associative array => array(array('templateId' => contentItem))
            $onlyItem = current(current($contentItems));
            // get the title out of the notification in the contentItem
            return $onlyItem['notification']->getTitle();
        }

        return $this->translatorService->transChoice('_az.email.notifications.subject.%count%', $count, array('%count%' => $count));
    }
492710
public function setSenders($senders)
    {
        $this->senders = [];
        if (count($senders)) {
            foreach ($senders as $channel => $sender) {
                $this->addSender($channel, $sender);
            }
        }

        return $this;
    }
1087754
public static function unsupportedRecipient(ChannelInterface $channel, Message $message, $recipient)
    {
        return new self(
            sprintf(
                'The recipient "%s" is not supported by channel "%s" for message "%s".',
                is_object($recipient) ? get_class($recipient) : gettype($recipient),
                get_class($channel),
                $message->getId()
            )
        );
    }
1250384
protected function create_list_component($component, $readyprocessors, $providers, $preferences, $user) {
        return new notification_list_component($component, $readyprocessors, $providers, $preferences, $user);
    }
511686
protected function processRoutes(IRouter $router, array $config) {
        $routes = array_get($config, 'routes', []);

        if ( ! is_array($routes)) {
            throw new InvalidConfigurationException(
                'Routing config "routes" must be an array.'
            );
        }

        foreach ($routes as $route) {
            list($method, $path, $action) = $this->gatherRouteFacts($route);

            if (empty($method) || empty($path) || empty($action)) {
                $message = s(
                    'Route must provide a "method", "path" and an "action". ' .
                    'Received method: "%s", path: "%s", action: "%s".',
                    is_scalar($method) ? $method : get_type($method),
                    is_scalar($path) ? $path : get_type($path),
                    is_scalar($action) ? $action : get_type($action)
                );

                throw new InvalidConfigurationException($message);
            }

            $router->route($method, $path, $action);
        }
    }
215204
public function setReplyTo(array $addresses): Email
    {
        $addresses = $this->transformAddressesToArray($addresses);
        $this->message->setReplyTo($addresses);

        return $this;
    }
1248333
public function addRecipient(Recipient $recipient){
        $this->to[] = array(
            'email' => $recipient->email,
            'name' => $recipient->name,
            'type' => $recipient->type
        );
        $this->merge_vars[] = array(
            'rcpt' => $recipient->email,
            'vars' => $recipient->getMergeVars()
        );
        $this->recipient_metadata[] = array(
            'rcpt' => $recipient->email,
            'values' => $recipient->getMetadata()
        );
        return $this;
    }
533792
function sendHideManialinkPage($recipient = null, $multicall = false)
    {
        $logins = $this->getLogins($recipient, true);
        if ($logins === false) {
            throw new InvalidArgumentException('recipient = ' . print_r($recipient, true));
        }

        if ($logins) {
            return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins), $multicall);
        }
        return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
    }
224751
public function sendNewsletter(array &$failedAddresses)
    {
        // params array for all recipients
        $params = array();

        // set a default subject
        $params['subject'] = $this->translatorService->trans('_az.email.newsletter.subject');

        // get the the non-recipient-specific contentItems of the newsletter
        $params[self::CONTENT_ITEMS] = $this->getNonRecipientSpecificNewsletterContentItems();

        // get recipientIds for the newsletter
        $recipientIds = $this->recipientProvider->getNewsletterRecipientIDs();

        $newsletterTemplate = $this->configParameter[AzineEmailExtension::TEMPLATES.'_'.AzineEmailExtension::NEWSLETTER_TEMPLATE];

        foreach ($recipientIds as $recipientId) {
            $failedAddress = $this->sendNewsletterFor($recipientId, $params, $newsletterTemplate);

            if (null !== $failedAddress && strlen($failedAddress) > 0) {
                $failedAddresses[] = $failedAddress;
            }
        }

        return sizeof($recipientIds) - sizeof($failedAddresses);
    }
534089
public static function create(string $template, $recipients, Address $sender = null)
    {
        $email = new static($template);

        $recipients = is_array($recipients) ? $recipients : [$recipients];
        foreach ($recipients as $recipient) {
            $email->addRecipient($recipient);
        }

        if (null !== $sender) {
            $email->setSender($sender);
        }

        return $email;
    }
1365548
private function createNotification(\ArrayIterator $recipients, MessageInterface $message)
    {
        $message = clone $message;
        $message->setRecipientDeviceCollection($recipients);

        $handlers = $this->getPayloadHandlers();

        foreach ($handlers as $handler) {
            if ($handler->isSupported($message)) {
                $notificationId = uniqid();
                $handler
                    ->setNotificationId($notificationId)
                    ->setMessage($message);

                $packedPayload  = $this->handlePayload($handler);
                $customData     = $handler->getCustomNotificationData();

                $notification = new Notification();
                $notification
                    ->setIdentifier($notificationId)
                    ->setType($message->getMessageType())
                    ->setRecipients($recipients)
                    ->setPayload($packedPayload)
                    ->setCustomNotificationData($customData)
                ;
                return $notification;
            }
        }

        throw new DomainException(
            sprintf(
                'Unhandled message type %s',
                $message->getMessageType()
            )
        );
    }
497221
public function Add($Recipient = '') {
      $this->Form->SetModel($this->ConversationModel);
      
      if ($this->Form->AuthenticatedPostBack()) {
         $RecipientUserIDs = array();
         $To = explode(',', $this->Form->GetFormValue('To', ''));
         $UserModel = new UserModel();
         foreach ($To as $Name) {
            if (trim($Name) != '') {
               $User = $UserModel->GetByUsername(trim($Name));
               if (is_object($User))
                  $RecipientUserIDs[] = $User->UserID;
            }
         }
         
         $this->EventArguments['Recipients'] = $RecipientUserIDs;
         $this->FireEvent('BeforeAddConversation');
         
         $this->Form->SetFormValue('RecipientUserID', $RecipientUserIDs);
         $ConversationID = $this->Form->Save($this->ConversationMessageModel);
         if ($ConversationID !== FALSE) {
            $Target = $this->Form->GetFormValue('Target', 'messages/'.$ConversationID);
            
            $this->RedirectUrl = Url($Target);
         }
      } else {
         if ($Recipient != '')
            $this->Form->SetValue('To', $Recipient);
      }
      if ($Target = Gdn::Request()->Get('Target'))
            $this->Form->AddHidden('Target', $Target);

      Gdn_Theme::Section('PostConversation');
      $this->Title(T('New Conversation'));
      $this->SetData('Breadcrumbs', array(array('Name' => T('Inbox'), 'Url' => '/messages/inbox'), array('Name' => $this->Data('Title'), 'Url' => 'messages/add')));
      $this->Render();      
   }
264303
protected function setDefaultLists(FirewallInterface $firewall, array $lists)
    {
        foreach ($lists as $listName => $state) {
            if (isset($this->lists[$listName])) {
                $list = $this->lists[$listName];
                $firewall->addList($list, $listName, $state);
            } else {
                throw new \Exception(sprintf('Firewall list "%s" not found.', $listName));
            }
        }

        return $this;
    }