protected function processMessageParts(array $payload, Swift_Mime_SimpleMessage $message): array
    {
        //Get the primary message.
        switch ($message->getContentType()) {
            case 'text/html':
            case 'multipart/mixed':
            case 'multipart/related':
            case 'multipart/alternative':
                $payload['HtmlBody'] = $message->getBody();

                break;

            default:
                $payload['TextBody'] = $message->getBody();

                break;
        }

        // Provide an alternate view from the secondary parts.
        if ($plain = $this->getMIMEPart($message, 'text/plain')) {
            $payload['TextBody'] = $plain->getBody();
        }

        if ($html = $this->getMIMEPart($message, 'text/html')) {
            $payload['HtmlBody'] = $html->getBody();
        }

        if ($message->getChildren()) {
            $payload['Attachments'] = [];

            foreach ($message->getChildren() as $attachment) {
                if (\is_object($attachment) && $attachment instanceof Swift_Mime_Attachment) {
                    $attachments = [
                        'Name'        => $attachment->getFilename(),
                        'Content'     => \base64_encode($attachment->getBody()),
                        'ContentType' => $attachment->getContentType(),
                    ];

                    if ($attachment->getDisposition() !== 'attachment' &&
                        $attachment->getId() !== null
                    ) {
                        $attachments['ContentID'] = 'cid:' . $attachment->getId();
                    }

                    $payload['Attachments'][] = $attachments;
                }
            }
        }

        return $payload;
    }
protected function processMessageParts(array $payload, Swift_Mime_SimpleMessage $message): array
    {
        //Get the primary message.
        switch ($message->getContentType()) {
            case 'text/html':
            case 'multipart/mixed':
            case 'multipart/related':
            case 'multipart/alternative':
                $payload['HtmlBody'] = $message->getBody();

                break;

            default:
                $payload['TextBody'] = $message->getBody();

                break;
        }

        // Provide an alternate view from the secondary parts.
        if ($plain = $this->getMIMEPart($message, 'text/plain')) {
            $payload['TextBody'] = $plain->getBody();
        }

        if ($html = $this->getMIMEPart($message, 'text/html')) {
            $payload['HtmlBody'] = $html->getBody();
        }

        if ($message->getChildren()) {
            $payload['Attachments'] = [];

            foreach ($message->getChildren() as $attachment) {
                if (\is_object($attachment) && $attachment instanceof Swift_Mime_Attachment) {
                    $attachments = [
                        'Name'        => $attachment->getFilename(),
                        'Content'     => \base64_encode($attachment->getBody()),
                        'ContentType' => $attachment->getContentType(),
                    ];

                    if ($attachment->getDisposition() !== 'attachment' &&
                        $attachment->getId() !== null
                    ) {
                        $attachments['ContentID'] = 'cid:' . $attachment->getId();
                    }

                    $payload['Attachments'][] = $attachments;
                }
            }
        }

        return $payload;
    }
protected function processMessageParts ( array $ payload , Swift_Mime_SimpleMessage $ message ) : array { //Get the primary message. switch ( $ message -> getContentType ( ) ) { case 'text/html' : case 'multipart/mixed' : case 'multipart/related' : case 'multipart/alternative' : $ payload [ 'HtmlBody' ] = $ message -> getBody ( ) ; break ; default : $ payload [ 'TextBody' ] = $ message -> getBody ( ) ; break ; } // Provide an alternate view from the secondary parts. if ( $ plain = $ this -> getMIMEPart ( $ message , 'text/plain' ) ) { $ payload [ 'TextBody' ] = $ plain -> getBody ( ) ; } if ( $ html = $ this -> getMIMEPart ( $ message , 'text/html' ) ) { $ payload [ 'HtmlBody' ] = $ html -> getBody ( ) ; } if ( $ message -> getChildren ( ) ) { $ payload [ 'Attachments' ] = [ ] ; foreach ( $ message -> getChildren ( ) as $ attachment ) { if ( \ is_object ( $ attachment ) && $ attachment instanceof Swift_Mime_Attachment ) { $ attachments = [ 'Name' => $ attachment -> getFilename ( ) , 'Content' => \ base64_encode ( $ attachment -> getBody ( ) ) , 'ContentType' => $ attachment -> getContentType ( ) , ] ; if ( $ attachment -> getDisposition ( ) !== 'attachment' && $ attachment -> getId ( ) !== null ) { $ attachments [ 'ContentID' ] = 'cid:' . $ attachment -> getId ( ) ; } $ payload [ 'Attachments' ] [ ] = $ attachments ; } } } return $ payload ; }
Applies the message parts and attachments
into the API Payload.

@param array                     $payload
@param \Swift_Mime_SimpleMessage $message

@return array
Applies the message parts and attachments into the API Payload .