protected function getRecipients(Swift_Mime_SimpleMessage $message): array
    {
        $recipients = [];

        if ($message->getTo() !== null) {
            foreach ($message->getTo() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        if ($message->getCc() !== null) {
            foreach ($message->getCc() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        if ($message->getBcc() !== null) {
            foreach ($message->getBcc() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        return $recipients;
    }
protected function getRecipients(Swift_Mime_SimpleMessage $message): array
    {
        $recipients = [];

        if ($message->getTo() !== null) {
            foreach ($message->getTo() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        if ($message->getCc() !== null) {
            foreach ($message->getCc() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        if ($message->getBcc() !== null) {
            foreach ($message->getBcc() as $email => $name) {
                $recipients[] = ['address' => \compact('name', 'email')];
            }
        }

        return $recipients;
    }
protected function getRecipients ( Swift_Mime_SimpleMessage $ message ) : array { $ recipients = [ ] ; if ( $ message -> getTo ( ) !== null ) { foreach ( $ message -> getTo ( ) as $ email => $ name ) { $ recipients [ ] = [ 'address' => \ compact ( 'name' , 'email' ) ] ; } } if ( $ message -> getCc ( ) !== null ) { foreach ( $ message -> getCc ( ) as $ email => $ name ) { $ recipients [ ] = [ 'address' => \ compact ( 'name' , 'email' ) ] ; } } if ( $ message -> getBcc ( ) !== null ) { foreach ( $ message -> getBcc ( ) as $ email => $ name ) { $ recipients [ ] = [ 'address' => \ compact ( 'name' , 'email' ) ] ; } } return $ recipients ; }
Get all the addresses this message should be sent to.

Note that SparkPost still respects CC, BCC headers in raw message itself.

@param \Swift_Mime_SimpleMessage $message

@return array
Get all the addresses this message should be sent to .