Sets multiple recipients by type.

@param  string  $type
@param  array  $recipients
@return $this
960767
public function setRecipients($type, array $recipients = [])
    {
        foreach ($recipients as $key => $recipient) {
            $this->setRecipient(
                $type,
                array_get($recipient, 'email'),
                array_get($recipient, 'name')
            );
        }

        return $this;
    }
970800
public function setChildren($children)
    {
        if (is_array($children)) {
            $c = [];
            foreach ($children as $name => $child) {
                list($package, $link, $children) = $child;
                $c[] = new self($name, $this->type, $package, $link, $children);
            }

            $this->children = $c;
        }

        return $this;
    }
791639
protected function createBuilder(array $recipients, $data, $callback)
    {
        $messageBuilder = new MessageBuilder($recipients, $data, $callback);

        if ($developerTo = $this->config->get('mail.overwrite_to')) {
            $messageBuilder->setOverwriteTo($developerTo);
        }

        return $messageBuilder;
    }
332958
public function removeRecipient(string $recipient): self
    {
        $itemPosition = array_search($recipient, $this->recipients);

        if (false !== $itemPosition) {
            unset($this->recipients[$itemPosition]);
        }

        unset($this->recipientVariables[$recipient]);

        return $this;
    }
906538
public function setType($type)
    {
        if (is_string($type)) {
            if ('all' == strtolower($type)) {
                $this->type = array_keys($this->cards);
            } else {
                $this->type = explode(',', $type);
            }
        } elseif (is_array($type)) {
            $this->type = $type;
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type array or string, "%s" given',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }

        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.");
        }
    }
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;
    }
1167623
public function setPostFields($fields, string $type = 'query')
    {
        if (is_array($fields)) {
            if ($type === 'json') {
                 $fields = json_encode($fields);
            } else {
                 $fields = http_build_query($fields);
            }
        }

        $this->options[CURLOPT_POSTFIELDS] = $fields;

        return $this;
    }
298510
public function fromArray(array $data)
    {
        if (!empty($data['id'])) {
            $this->setId($data['id']);
        }

        if (isset($data['recipients'])) {
            $this->setRecipients($data['recipients']);
        }

        if (isset($data['recipient'])) {
            $this->addRecipient($data['recipient']);
        }

        if (isset($data['from'])) {
            $this->setFrom($data['from']);
        }

        if (isset($data['body'])) {
            $this->setBody($data['body']);
        }

        if (isset($data['data'])) {
            $this->setData($data['data']);
        }

        if (isset($data['template_id'])) {
            $this->setTemplateId($data['template_id']);
        }

        if (isset($data['status'])) {
            $this->setStatus($data['status']);
        } else {
            $this->setStatus(MessageStatus::STATUS_QUEUED);
        }

        return $this;
    }
1267118
public function setType($type) {
        $types = [static::TYPE_DEFINED_ONLY, static::TYPE_ARBITRARY];
        if (in_array($type, $types)) {
            $this->type = $type;
        }
        return $this;
    }
17345
public function setType($type = self::TYPE_TEXT) {
		if (!in_array($type, array(self::TYPE_TEXT, self::TYPE_HTML))) {
			throw new MailException('invalid type: ' . $type);
		}
		$this->type = $type;
	}
449701
public function addDuplicateLinks($type, array $packages)
    {
        if ( ! isset($this->duplicateLinks[$type])) {
            $this->duplicateLinks[$type] = [];
        }

        $this->duplicateLinks[$type] = array_merge(
            $this->duplicateLinks[$type],
            $packages
        );

        return $this;
    }
778262
protected function validateRecipients(array $recipients)
    {
        if (true == empty($recipients)) {
            throw new \InvalidArgumentException('Recipients list should not be empty');
        }

        foreach ($recipients as $recipient) {
            if (true == is_string($recipient) && $this->isValidMail($recipient)) {
                continue;
            }

            throw new \InvalidArgumentException(sprintf(
                'Given recipients list %s has invalid recipient %s',
                var_export($recipients, true),
                var_export($recipient, true)
            ));
        }
    }
1329752
public function setFrom(array $addresses): Email
    {
        $addresses = $this->transformAddressesToArray($addresses);
        $this->message->setFrom($addresses);

        return $this;
    }
1216735
public function type($type)
    {
        $types = is_array($type) ? $type : func_get_args();

        $this->types = array_merge($this->types, $types);

        return $this;
    }
72915
public function addRecipient($recipient)
    {
        if (is_string($recipient)) {
            $recipient = new Recipient($recipient);
        } elseif (!$recipient instanceof Recipient) {
            throw new \InvalidArgumentException('$recipient must be a string or an instance of Recipient.');
        }

        $this->recipients[] = $recipient;

        return $this;
    }
354062
public function setRecipientType($recipientType)
    {
        $allowed_values = array('alliance', 'character', 'corporation', 'mailing_list');
        if ((!in_array($recipientType, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'recipientType', must be one of 'alliance', 'character', 'corporation', 'mailing_list'");
        }
        $this->container['recipientType'] = $recipientType;

        return $this;
    }