src/Archangel.php
protected function buildMessageWithAttachments()
    {
        $message = array();

        if (!empty($this->plainMessage) || !empty($this->htmlMessage)) {
            array_push($message, "--{$this->boundaryMixed}");
        }

        if (!empty($this->plainMessage) && !empty($this->htmlMessage)) {
            array_push($message, "Content-Type: multipart/alternative; boundary={$this->boundaryAlternative}");
            array_push($message, '');
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
            array_push($message, "--{$this->boundaryAlternative}--");
            array_push($message, '');
        } elseif (!empty($this->plainMessage)) {
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
        } elseif (!empty($this->htmlMessage)) {
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
        }
        foreach ($this->attachments as $attachment) {
            array_push($message, "--{$this->boundaryMixed}");
            array_push($message, "Content-Type: {$attachment['type']}; name=\"{$attachment['title']}\"");
            array_push($message, 'Content-Transfer-Encoding: base64');
            array_push($message, 'Content-Disposition: attachment');
            array_push($message, '');
            array_push($message, $this->buildAttachmentContent($attachment['path']));
        }
        array_push($message, "--{$this->boundaryMixed}--");

        return implode(self::LINE_BREAK, $message);
    }
protected function buildMessageWithAttachments()
    {
        $message = array();

        if (!empty($this->plainMessage) || !empty($this->htmlMessage)) {
            array_push($message, "--{$this->boundaryMixed}");
        }

        if (!empty($this->plainMessage) && !empty($this->htmlMessage)) {
            array_push($message, "Content-Type: multipart/alternative; boundary={$this->boundaryAlternative}");
            array_push($message, '');
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
            array_push($message, "--{$this->boundaryAlternative}--");
            array_push($message, '');
        } elseif (!empty($this->plainMessage)) {
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
        } elseif (!empty($this->htmlMessage)) {
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
        }
        foreach ($this->attachments as $attachment) {
            array_push($message, "--{$this->boundaryMixed}");
            array_push($message, "Content-Type: {$attachment['type']}; name=\"{$attachment['title']}\"");
            array_push($message, 'Content-Transfer-Encoding: base64');
            array_push($message, 'Content-Disposition: attachment');
            array_push($message, '');
            array_push($message, $this->buildAttachmentContent($attachment['path']));
        }
        array_push($message, "--{$this->boundaryMixed}--");

        return implode(self::LINE_BREAK, $message);
    }
protected function buildMessageWithAttachments ( ) { $ message = array ( ) ; if ( ! empty ( $ this -> plainMessage ) || ! empty ( $ this -> htmlMessage ) ) { array_push ( $ message , "--{$this->boundaryMixed}" ) ; } if ( ! empty ( $ this -> plainMessage ) && ! empty ( $ this -> htmlMessage ) ) { array_push ( $ message , "Content-Type: multipart/alternative; boundary={$this->boundaryAlternative}" ) ; array_push ( $ message , '' ) ; array_push ( $ message , "--{$this->boundaryAlternative}" ) ; $ message = array_merge ( $ message , $ this -> buildPlainMessageHeader ( ) ) ; array_push ( $ message , $ this -> plainMessage ) ; array_push ( $ message , "--{$this->boundaryAlternative}" ) ; $ message = array_merge ( $ message , $ this -> buildHtmlMessageHeader ( ) ) ; array_push ( $ message , $ this -> htmlMessage ) ; array_push ( $ message , "--{$this->boundaryAlternative}--" ) ; array_push ( $ message , '' ) ; } elseif ( ! empty ( $ this -> plainMessage ) ) { $ message = array_merge ( $ message , $ this -> buildPlainMessageHeader ( ) ) ; array_push ( $ message , $ this -> plainMessage ) ; } elseif ( ! empty ( $ this -> htmlMessage ) ) { $ message = array_merge ( $ message , $ this -> buildHtmlMessageHeader ( ) ) ; array_push ( $ message , $ this -> htmlMessage ) ; } foreach ( $ this -> attachments as $ attachment ) { array_push ( $ message , "--{$this->boundaryMixed}" ) ; array_push ( $ message , "Content-Type: {$attachment['type']}; name=\"{$attachment['title']}\"" ) ; array_push ( $ message , 'Content-Transfer-Encoding: base64' ) ; array_push ( $ message , 'Content-Disposition: attachment' ) ; array_push ( $ message , '' ) ; array_push ( $ message , $ this -> buildAttachmentContent ( $ attachment [ 'path' ] ) ) ; } array_push ( $ message , "--{$this->boundaryMixed}--" ) ; return implode ( self :: LINE_BREAK , $ message ) ; }
Build multi-part message with attachments

@return string email message
Build multi - part message with attachments