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_Message $message
@return array
13805
protected function getToAddresses( 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() ) );

		return $to;
	}
784242
public function getMessages()
    {
        $message = new IncomingMessage(Location::PATTERN, $this->event->get('ToUserName'), $this->event->get('FromUserName'),
            $this->event);
        $message->setLocation($this->getLocation());

        return [$message];
    }
910756
public function getLocations(LocationListMessage $message): array
    {
        $path = sprintf('sites/%d/locations', $message->getSiteId());

        $response = $this->getClient()->sendRequest('GET', $path);

        /** @var Location[] $models */
        $models = $this->getModelFactory()->createMany(Location::class, $response);

        return $models;
    }
1329698
public function getFromAddress()
    {
        // get sender address
        $headers = $this->message->headers();
        $from    = rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
        $from    = $from[1];

        return $from;
    }
88731
protected function numberOfRecipients(Swift_Mime_SimpleMessage $message)
    {
        return count(array_merge(
            (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
        ));
    }
144399
protected function parseMessage($message)
    {
        $headerAndBody = explode("\r\n\r\n", $message, 2);
        $headers = explode("\r\n", $headerAndBody[0]);

        return [$this->parseHeader($headers), $headerAndBody[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;
    }
455174
protected function getAttachmentsArray($message)
    {
        $attachments = array();

        foreach ($message->getChildren() as $entity) {
            if ($entity instanceof Swift_Attachment) {
                $attachments[] = array(
                    'name' => $entity->getFilename(),
                    'data' => $entity->getBody(),
                    'content_id' => "<{$entity->getContentType()}>"
                );
            }
        }

        return $attachments;
    }
1061859
public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
    {
        $message->generateId();

        // Create a mbox-like header
        $mboxFrom = $this->getReversePath($message);
        $mboxDate = strftime('%c', $message->getDate()->getTimestamp());
        $messageString = sprintf('From %s %s', $mboxFrom, $mboxDate) . chr(10);

        // Add the complete mail inclusive headers
        $messageString .= $message->toString();
        $messageString .= chr(10) . chr(10);

        // Write the mbox file
        file_put_contents($this->mboxPathAndFilename, $messageString, FILE_APPEND | LOCK_EX);

        // Return every recipient as "delivered"
        return count((array)$message->getTo()) + count((array)$message->getCc()) + count((array)$message->getBcc());
    }
577693
protected function numberOfRecipients(Swift_Mime_Message $message)
    {
        return count(array_merge(
            (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
        ));
    }
579600
protected function attachments(SlackMessage $message)
    {
        return collect($message->attachments)->map(function ($attachment) use ($message) {
            return array_filter([
                'actions' => $attachment->actions,
                'author_icon' => $attachment->authorIcon,
                'author_link' => $attachment->authorLink,
                'author_name' => $attachment->authorName,
                'color' => $attachment->color ?: $message->color(),
                'fallback' => $attachment->fallback,
                'fields' => $this->fields($attachment),
                'footer' => $attachment->footer,
                'footer_icon' => $attachment->footerIcon,
                'image_url' => $attachment->imageUrl,
                'mrkdwn_in' => $attachment->markdown,
                'pretext' => $attachment->pretext,
                'text' => $attachment->content,
                'thumb_url' => $attachment->thumbUrl,
                'title' => $attachment->title,
                'title_link' => $attachment->url,
                'ts' => $attachment->timestamp,
            ]);
        })->all();
    }
1010983
protected function allContacts(Swift_Mime_SimpleMessage $message)
    {
        return array_merge(
            (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
        );
    }
222331
public function getHeaders()
    {
        if ($this->_headers === null) {
            if (!$this->_mail) {
                $this->_headers = array();
            } else {
                $part = $this->_mail->getRawHeader($this->_messageNum);
                Zend_Mime_Decode::splitMessage($part, $this->_headers, $null);
            }
        }

        return $this->_headers;
    }
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;
		}
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;
    }
496865
public function getFields(FieldListMessage $message): array
    {
        $path = sprintf('sites/%d/fields', $message->getSiteId());

        $response = $this->getClient()->sendRequest('GET', $path);

        /** @var Field[] $models */
        $models = $this->getModelFactory()->createMany(Field::class, $response);

        return $models;
    }
680571
private function findNumberOfSentMails() {
        $sendCount = 0;
        if ($this->messageFormat->getVersion() === 'v3.1') {
            $messages = $this->resultApi->getBody()['Messages'];
            foreach ($messages as $message) {


                if (isset($message['To'])) {
                    $sendCount += count($message['To']);
                }
                if (isset($message['Bcc']) && (!empty($message['Bcc']))) {
                    $sendCount += count($message['Bcc']);
                }
                if (isset($message['Cc']) && (!empty($message['Cc']))) {
                    $sendCount += count($message['Cc']);
                }
            }
            return $sendCount;
        }
        if ($this->messageFormat->getVersion() === 'v3') {
            if (isset($this->resultApi->getBody()['Sent'])) {
                $sendCount += count($this->resultApi->getBody()['Sent']);
            }
            return $sendCount;
        }
        return $sendCount;
    }