Get all the addresses this message should be sent to.

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

@param  \Swift_Mime_SimpleMessage $message
@return array
514839
protected function getTo(Swift_Mime_SimpleMessage $message)
    {
        $to = [];

        if ($message->getTo()) {
            $to = array_merge($to, array_keys($message->getTo()));
        }

        if ($message->getCc()) {
            $to = array_merge($to, array_keys($message->getCc()));
        }

        if ($message->getBcc()) {
            $to = array_merge($to, array_keys($message->getBcc()));
        }

        return $to;
    }
463241
protected function _doSend( Swift_Mime_SimpleMessage $message, &$failedRecipients = null )
		{
			$date = date( 'D, j F Y H:i:s O' );
			if( function_exists( 'hash_hmac' ) and in_array( 'sha1', hash_algos() ) ) {
				$hmac = base64_encode( hash_hmac( 'sha1', $date, $this->AWSSecretKey, true ) );
			}
			else {
				$hmac = $this->calculate_RFC2104HMAC( $date, $this->AWSSecretKey );
			}
			$auth = "AWS3-HTTPS AWSAccessKeyId=" . $this->AWSAccessKeyId . ", Algorithm=HmacSHA1, Signature=" . $hmac;

			$fp = $this->getRawSocket();
			$host = parse_url( $this->endpoint, PHP_URL_HOST );
			$path = parse_url( $this->endpoint, PHP_URL_PATH );

			$socket = new ChunkedTransferSocket( $fp, $host, $path, "POST", $this->persistent );

			$socket->header("Date", $date);
			$socket->header("X-Amzn-Authorization", $auth);

			$socket->write("Action=SendRawEmail&RawMessage.Data=");

			$ais = new Swift_AWSInputByteStream($socket);
			$message->toByteStream($ais);
			$ais->flushBuffers();

			$result = $socket->read();

			if( ! $this->persistent ) {
				fclose($fp);
			}

			return $result;
		}
281034
private function getHeaders(PushMessage $message) : array
    {
        return [
            'Authorization' => 'key='.$this->apiKey,
            'Content-Type' => 'application/json',
            'Content-Length' => $message->getContentLength(),
            'Encryption' => 'keyid=p256dh;salt='.$message->getSalt(),
            'Crypto-Key' => 'keyid=p256dh;dh='.$message->getCryptoKey(),
            'Content-Encoding' => 'aesgcm',
            'TTL' => $message->getTTL(),
        ];
    }
939652
public function get($message)
    {
        if (isset($this->messages[$message])) {
            $message = $this->messages[$message][0];
        }
        return $this->replacePlaceholders($message, array_slice(func_get_args(), 1));
    }
1107543
protected function getTo(Swift_Mime_Message $message)
    {
        $destinations = [];

        $contacts = array_merge(
            (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
        );

        foreach ($contacts as $address => $display)
        {
            $destinations[] = $address;
        }

        return $destinations;
    }
131041
protected static function getMessagePrimaryContentType(Swift_Mime_Message $message)
    {
        $contentType = $message->getContentType();
        if (self::supportsContentType($contentType)) {
            return $contentType;
        }
        // SwiftMailer hides the content type set in the constructor of Swift_Mime_SimpleMessage as soon
        // as you add another part to the message. We need to access the protected property
        // userContentType to get the original type.
        $messageRef = new \ReflectionClass($message);
        if ($messageRef->hasProperty('userContentType')) {
            $propRef = $messageRef->getProperty('userContentType');
            $propRef->setAccessible(true);
            $contentType = $propRef->getValue($message);
        }

        return $contentType;
    }
59856
protected function getPlaceHolders(/*# string */ $message)/*# : array */
    {
        // not found
        if (false === strpos($message, '{')) {
            return [];
        }

        $matches = [];
        $pattern = '~\{([^\}]+)\}~';
        if (preg_match_all($pattern, $message, $matches)) {
            return array_combine($matches[1], $matches[0]);
        }
        return [];
    }
1076314
protected static function findUserDefinedHeaders(Swift_Mime_Message $message)
    {
        $messageHeaders = $message->getHeaders();
        $userDefinedHeaders = [];
        /* At this moment $messageHeaders is left with non-Mailjet specific headers
         *
         */
        /** @var \Swift_Mime_Headers_AbstractHeader $header */
        foreach ($messageHeaders->getAll() as $header) {
            if (0 === strpos($header->getFieldName(), 'X-')) {
                $userDefinedHeaders[$header->getFieldName()] = $header->getFieldBody();
            }
        }

        return $userDefinedHeaders;
    }
309356
protected function getRecipients( Swift_Mime_Message $message )
	{
		$to = [];

		if ( $message->getTo() )
			$to = array_merge( $to, array_keys( $message->getTo() ) );

		if ( $message->getCc() )
			$to = array_merge( $to, array_keys( $message->getCc() ) );

		if ( $message->getBcc() )
			$to = array_merge( $to, array_keys( $message->getBcc() ) );

		$recipients = array_map( function ( $address )
		{
			return compact( 'address' );
		}, $to );

		return $recipients;
	}
515072
protected function getRecipients(Swift_Mime_Message $message) {
        $to = [];
        if ($message->getTo()) {
            $to = array_merge($to, $message->getTo());
        }
        if ($message->getCc()) {
            $to = array_merge($to, $message->getCc());
        }
        if ($message->getBcc()) {
            $to = array_merge($to, $message->getBcc());
        }
        $recipients = [];
        foreach ($to as $address => $name) {
            if (!is_null($name)) {
                $recipients[] = ['Email' => $address, 'Name' => $name];
            } else {
                $recipients[] = ['Email' => $address];
            }
        }
        return $recipients;
    }
333817
public function getTouchDowns(AbstractMessage $message)
    {
        $touchdown = array();
        $messageSegments = $message->getEncryptedSegments();
        /** @var AbstractSegment $msgSeg */
        foreach ($messageSegments as $msgSeg) {
            $segment = $this->findSegmentForReference('HIRMS', $msgSeg);
            if (null != $segment) {
                $parts = $this->splitSegment($segment);
                // remove header
                array_shift($parts);
                foreach ($parts as $p) {
                    $pSplit = $this->splitDeg($p);
                    if ($pSplit[0] == 3040) {
                        $td = $pSplit[3];
                        $touchdown[$msgSeg->getName()] = $td;
                    }
                }
            }
        }

        return $touchdown;
    }
770484
protected function getCcAddresses()
    {
        $ccAddresses = array();

        if (isset($this->options['cc'])) {
            foreach ($this->options['cc'] as $address) {
                $ccAddresses[] = $address;
            }
        }

        return $ccAddresses;
    }
1065344
protected function prepareTo(Swift_Mime_SimpleMessage $message)
    {
        $to = array_map(function ($name, $address) {
            return $name ? $name." <{$address}>" : $address;
        }, $this->combineTo($message), array_keys($this->combineTo($message)));

        return implode(',', $to);
    }
1013053
public function split(Message $message) : array
    {
        $splittedMessages = [];
        $messageName      = $message->getHeaders()->get(MessageFlowModule::INTEGRATION_MESSAGING_CQRS_MESSAGE_NAME_HEADER);

        foreach($this->messageFlowMapper->getFlowRegistrationsFor($messageName) as $messageFlowRegistration) {
            $registrationMessage     = MessageBuilder::fromMessage($message)
                ->setHeader(MessageFlowModule::INTEGRATION_MESSAGING_CQRS_MESSAGE_FLOW_REGISTRATION_HEADER, $messageFlowRegistration);

            if (!$messageFlowRegistration->isExternalFlow()) {
                $registrationMessage = $registrationMessage
                    ->setHeader(MessageFlowModule::INTEGRATION_MESSAGING_CQRS_MESSAGE_CLASS_HEADER, $messageFlowRegistration->getMessageClassName());
            }

            $splittedMessages[] = $registrationMessage
                                    ->build();
        }

        return $splittedMessages;
    }
967034
protected function getSchemaForMessage($message)
    {
        // Form schema messages treat simple strings as plain text, so nest for html messages
        $value = $message['message'];
        if ($message['messageCast'] === ValidationResult::CAST_HTML) {
            $value = ['html' => $message];
        }
        return [
            'value' => $value,
            'type' => $message['messageType'],
            'field' => empty($message['fieldName']) ? null : $message['fieldName'],
        ];
    }
129262
public function getChannel($message)
    {
        if (is_int($message)) {
            return $this->channels[$message];
        }
        return $this->channels[$message->getChannel()];
    }
938967
protected function getMessageInfo(Swift_Mime_SimpleMessage $message)
    {
        return sprintf(
            "<!--\nFrom:%s, \nto:%s, \nreply-to:%s, \ncc:%s, \nbcc:%s, \nsubject:%s\n-->\n",
            json_encode($message->getFrom()),
            json_encode($message->getTo()),
            json_encode($message->getReplyTo()),
            json_encode($message->getCc()),
            json_encode($message->getBcc()),
            $message->getSubject()
        );
    }