Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Envelope.php

function Envelope::setRecipients

Parameters

Address[] $recipients:

3 calls to Envelope::setRecipients()
DelayedEnvelope::setRecipients in vendor/symfony/mailer/DelayedEnvelope.php
DelayedEnvelope::setRecipients in vendor/symfony/mailer/DelayedEnvelope.php
Envelope::__construct in vendor/symfony/mailer/Envelope.php
1 method overrides Envelope::setRecipients()
DelayedEnvelope::setRecipients in vendor/symfony/mailer/DelayedEnvelope.php

File

vendor/symfony/mailer/Envelope.php, line 66

Class

Envelope
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\Mailer

Code

public function setRecipients(array $recipients) : void {
    if (!$recipients) {
        throw new InvalidArgumentException('An envelope must have at least one recipient.');
    }
    $this->recipients = [];
    foreach ($recipients as $recipient) {
        if (!$recipient instanceof Address) {
            throw new InvalidArgumentException(\sprintf('A recipient must be an instance of "%s" (got "%s").', Address::class, get_debug_type($recipient)));
        }
        $this->recipients[] = new Address($recipient->getAddress());
    }
}
RSS feed
Powered by Drupal