Add a hybrid recipient for printed letters

@param Recipient\Hybrid|AbstractRecipient $recipient

@return self
764613
public function addRecipientPrinted(Recipient\Hybrid $recipient): Envelope
    {
        if ($this->isNormalLetter()) {
            throw new LogicException(
                sprintf('Can not set recipientsPrinted if message type is "%s"', self::LETTER_TYPE_NORMAL)
            );
        }

        if (count($this->getRecipients())) {
            throw new LogicException('It must not be set more than one printed recipient');
        }

        $this->data['recipientsPrinted'][] = $recipient;

        return $this;
    }
859585
protected function addRecipient(string $headerName, string $address, array $variables): MessageBuilder
    {
        if (array_key_exists($headerName, $this->counters['recipients'])) {
            if (self::RECIPIENT_COUNT_LIMIT === $this->counters['recipients'][$headerName]) {
                if (false === $this->autoSend) {
                    throw TooManyRecipients::whenAutoSendDisabled();
                }
                $this->finalize();
            }
        }

        parent::addRecipient($headerName, $address, $variables);

        if (array_key_exists($headerName, $this->counters['recipients']) && !array_key_exists('id', $variables)) {
            $variables['id'] = $headerName.'_'.$this->counters['recipients'][$headerName];
        }

        $this->batchRecipientAttributes[$address] = $variables;

        return $this;
    }
1190554
protected function setPushableRecipient($recipientType, $recipient)
    {
        if ($recipientType === "device") {
            $this->recipientType = "device_iden";
            $this->recipient = $recipient;
        } else if ($recipientType === "channel") {
            $this->recipientType = "channel_tag";
            $this->recipient = $recipient;
        } else if ($recipientType === "email") {
            if (filter_var($recipient, FILTER_VALIDATE_EMAIL) !== false) {
                $this->recipientType = "email";
                $this->recipient = $recipient;
            } else {
                throw new Exceptions\InvalidRecipientException("Invalid email address.");
            }
        } else {
            throw new Exceptions\InvalidRecipientException("Unknown recipient type.");
        }
    }
498726
public static Predicate<Message> forRecipient(final String recipient) {
		return new Predicate<Message>() {
			@Override
			public boolean apply(final Message input) {
				Address[] addresses;
				try {
					addresses = input.getAllRecipients();
					if (addresses == null) {
						return false;
					}
					for (Address address : addresses) {
						if (StringUtils.equalsIgnoreCase(address.toString(), recipient)) {
							return true;
						}
					}
				} catch (MessagingException e) {
					throw new MailException("Error while reading recipients", e);
				}
				return false;
			}

			@Override
			public String toString() {
				return String.format("recipient to include %s", recipient);
			}
		};
	}
288529
@Override
    public void addRecipient(final javax.mail.Message.RecipientType type, final Address address) throws MessagingException {
        throw new IllegalWriteException("Mock messages are read-only");
    }
130001
public function addMailHeader($header, $email, $name = null)
    {
        $address = $this->formatHeader((string) $email, (string) $name);
        $this->_headers[] = sprintf('%s: %s', (string) $header, $address);
        return $this;
    }
889460
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        unset($payload['sender'], $payload['recipient']);

        return new static($senderId, $recipientId, $payload);
    }
226048
public function addRecipientVariable(
        string $recipient,
        string $recipientVariable,
        string $recipientVariableValue
    ): self {
        if (! isset($this->recipientVariables[$recipient])) {
            $this->recipientVariables[$recipient] = [];
        }

        $this->recipientVariables[$recipient][$recipientVariable] = $recipientVariableValue;

        return $this;
    }
876721
public function removeRecipientVariable(string $recipient, string $recipientVariable): self
    {
        unset($this->recipientVariables[$recipient][$recipientVariable]);

        return $this;
    }
1091987
public function addRecipientConditions(QueryBuilder $builder, IdentifierRecipientInterface $recipient)
    {
        $alias = $builder->getRootAliases()[0];
        $builder
            ->where(
                $builder->expr()->andX(
                    $builder->expr()->eq($alias . '.recipientClass', ':class'),
                    $builder->expr()->eq($alias . '.recipientId', ':id')
                )
            )
            ->setParameter('class', ClassUtils::getClass($recipient))
            ->setParameter('id', $recipient->getId())
        ;

        return $builder;
    }
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;
    }
492332
private function buildRecipient(
        $email,
        $name,
        array $tags,
        array $metadata,
        array $substitutionData,
        $originalEmail = ''
    ) {
        $recipient = ['address' => ['email' => $this->overrideRecipient($email)]];

        if ($name) {
            $recipient['address']['name'] = $name;
        }

        if ($originalEmail) {
            $recipient['address']['header_to'] = $originalEmail;
        }

        if (isset($tags[$email])) {
            $recipient['tags'] = $tags[$email];
        }

        if (isset($metadata[$email])) {
            $recipient['metadata'] = $metadata[$email];
        }

        if (isset($substitutionData[$email])) {
            $recipient['substitution_data'] = $substitutionData[$email];
        }

        return $recipient;
    }
865321
public function addRecipients($recipients)
    {
        try {
            if (is_array($recipients)) {
                foreach ($recipients as $recipientsOne) {
                    $this->addRecipient($recipientsOne);
                }
            } else {
                $this->addRecipient($recipientsOne);
            }
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
1268649
public function addRecipient(Recipient $recipient)
    {
        if (!$recipient instanceof Device && !$recipient instanceof Topic) {
            throw new \UnexpectedValueException('currently phpFCM only supports topic and single device messages');
        }

        if (!isset($this->recipientType)) {
            $this->recipientType = get_class($recipient);
        }

        if ($this->recipientType !== get_class($recipient)) {
            throw new \InvalidArgumentException('mixed recepient types are not supported by FCM');
        }

        $this->recipients[] = $recipient;
        return $this;
    }
1016457
public function message(string $recipient, $message, array $options = []): SendResponse
    {
        $message = $this->isValidMessage($message);
        $options = $this->isValidOptions($options, $message);

        $request = new SendRequest($this->pageToken, $message, $recipient, $options);
        $response = $this->client->post('me/messages', $request->build());

        return new SendResponse($response);
    }
68291
public function findUndeliveredRecipientNotification(IdentifierRecipientInterface $recipient)
    {
        $builder = $this->createQueryBuilder('notification');

        $this->addRecipientConditions($builder, $recipient);

        $builder->andWhere($builder->expr()->isNull('notification.deliveredAt'));

        return $builder->getQuery()->getResult();
    }
875501
public function addEmail(\Sulu\Bundle\ContactBundle\Entity\Email $emails)
    {
        $this->emails[] = $emails;

        return $this;
    }