lib/mail/Mail.php
private function addRecipientEmails(
        $emailType,
        $emails,
        $personalizationIndex = null,
        $personalization = null
    ) {
        $emailFunctionCall = "add" . $emailType;

        if (current($emails) instanceof EmailAddress) {
            foreach ($emails as $email) {
                $this->$emailFunctionCall(
                    $email,
                    $name = null,
                    $personalizationIndex,
                    $personalization
                );
            }
        } else {
            foreach ($emails as $email => $name) {
                $this->$emailFunctionCall(
                    $email,
                    $name,
                    $personalizationIndex,
                    $personalization
                );
            }
        }
    }
private function addRecipientEmails(
        $emailType,
        $emails,
        $personalizationIndex = null,
        $personalization = null
    ) {
        $emailFunctionCall = "add" . $emailType;

        if (current($emails) instanceof EmailAddress) {
            foreach ($emails as $email) {
                $this->$emailFunctionCall(
                    $email,
                    $name = null,
                    $personalizationIndex,
                    $personalization
                );
            }
        } else {
            foreach ($emails as $email => $name) {
                $this->$emailFunctionCall(
                    $email,
                    $name,
                    $personalizationIndex,
                    $personalization
                );
            }
        }
    }
private function addRecipientEmails ( $ emailType , $ emails , $ personalizationIndex = null , $ personalization = null ) { $ emailFunctionCall = "add" . $ emailType ; if ( current ( $ emails ) instanceof EmailAddress ) { foreach ( $ emails as $ email ) { $ this -> $ emailFunctionCall ( $ email , $ name = null , $ personalizationIndex , $ personalization ) ; } } else { foreach ( $ emails as $ email => $ name ) { $ this -> $ emailFunctionCall ( $ email , $ name , $ personalizationIndex , $ personalization ) ; } } }
Adds an array of To, Cc or Bcc objects to a Personalization object

@param string $emailType Object type name: To, Cc
or Bcc
@param To[]|Cc[]|Bcc[] $emails Array of email recipients
@param int|null $personalizationIndex Index into an array of
existing Personalization
objects
@param Personalization|null $personalization A Personalization object
Adds an array of To Cc or Bcc objects to a Personalization object