private function _buildRaw()
    {
        $boundary = md5(uniqid(rand(), true));
        $raw_message = 'From: ' . $this->_encodeHeader($this->_source) . "\n";
        if (!empty($this->_to)) {
            $raw_message .= 'To: ' . $this->_encodeHeader($this->_to) . "\n";
        }
        if (!empty($this->_cc)) {
            $raw_message .= 'cc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_bcc)) {
            $raw_message .= 'Bcc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_replyTo)) {
            $raw_message .= 'Reply-To: ' . $this->_encodeHeader($this->_replyTo) . "\n";
        }

        $raw_message .= 'Subject: =?' . $this->_charset . '?B?' . base64_encode($this->_subject) . "?=\n";
        $raw_message .= 'MIME-Version: 1.0' . "\n";

        $raw_message .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . "\n"; 
        $raw_message .= "\n--{$boundary}\n";
        $raw_message .= 'Content-Type: multipart/alternative; boundary="alt-' . $boundary . '"' . "\n";

        if (strlen($this->_body) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/plain; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_body . "\n";
        }

        if (strlen($this->_htmlBody) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/html; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_htmlBody . "\n";
        }
        $raw_message .= "\n--alt-{$boundary}--\n";

        foreach ($this->_attachments as $attachment) {
            $raw_message .= "\n--{$boundary}\n";
            $raw_message .= 'Content-Type: ' . $attachment['mimeType'] . '; name="' . $attachment['name'] . '"' . "\n";
            if (!empty($attachment['contentId'])) {
                $raw_message .= 'Content-ID' . $attachment['contentId'] . "\n";
            }
            $raw_message .= 'Content-Transfer-Encoding: base64' . "\n";
            $raw_message .= "\n" . chunk_split(base64_encode($attachment['data']), 76, "\n") . "\n";
        }

        $raw_message .= "\n--{$boundary}--\n";

        return base64_encode($raw_message);
    }
private function _buildRaw()
    {
        $boundary = md5(uniqid(rand(), true));
        $raw_message = 'From: ' . $this->_encodeHeader($this->_source) . "\n";
        if (!empty($this->_to)) {
            $raw_message .= 'To: ' . $this->_encodeHeader($this->_to) . "\n";
        }
        if (!empty($this->_cc)) {
            $raw_message .= 'cc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_bcc)) {
            $raw_message .= 'Bcc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_replyTo)) {
            $raw_message .= 'Reply-To: ' . $this->_encodeHeader($this->_replyTo) . "\n";
        }

        $raw_message .= 'Subject: =?' . $this->_charset . '?B?' . base64_encode($this->_subject) . "?=\n";
        $raw_message .= 'MIME-Version: 1.0' . "\n";

        $raw_message .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . "\n"; 
        $raw_message .= "\n--{$boundary}\n";
        $raw_message .= 'Content-Type: multipart/alternative; boundary="alt-' . $boundary . '"' . "\n";

        if (strlen($this->_body) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/plain; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_body . "\n";
        }

        if (strlen($this->_htmlBody) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/html; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_htmlBody . "\n";
        }
        $raw_message .= "\n--alt-{$boundary}--\n";

        foreach ($this->_attachments as $attachment) {
            $raw_message .= "\n--{$boundary}\n";
            $raw_message .= 'Content-Type: ' . $attachment['mimeType'] . '; name="' . $attachment['name'] . '"' . "\n";
            if (!empty($attachment['contentId'])) {
                $raw_message .= 'Content-ID' . $attachment['contentId'] . "\n";
            }
            $raw_message .= 'Content-Transfer-Encoding: base64' . "\n";
            $raw_message .= "\n" . chunk_split(base64_encode($attachment['data']), 76, "\n") . "\n";
        }

        $raw_message .= "\n--{$boundary}--\n";

        return base64_encode($raw_message);
    }
private function _buildRaw ( ) { $ boundary = md5 ( uniqid ( rand ( ) , true ) ) ; $ raw_message = 'From: ' . $ this -> _encodeHeader ( $ this -> _source ) . "\n" ; if ( ! empty ( $ this -> _to ) ) { $ raw_message .= 'To: ' . $ this -> _encodeHeader ( $ this -> _to ) . "\n" ; } if ( ! empty ( $ this -> _cc ) ) { $ raw_message .= 'cc: ' . $ this -> _encodeHeader ( $ this -> _cc ) . "\n" ; } if ( ! empty ( $ this -> _bcc ) ) { $ raw_message .= 'Bcc: ' . $ this -> _encodeHeader ( $ this -> _cc ) . "\n" ; } if ( ! empty ( $ this -> _replyTo ) ) { $ raw_message .= 'Reply-To: ' . $ this -> _encodeHeader ( $ this -> _replyTo ) . "\n" ; } $ raw_message .= 'Subject: =?' . $ this -> _charset . '?B?' . base64_encode ( $ this -> _subject ) . "?=\n" ; $ raw_message .= 'MIME-Version: 1.0' . "\n" ; $ raw_message .= 'Content-Type: multipart/mixed; boundary="' . $ boundary . '"' . "\n" ; $ raw_message .= "\n--{$boundary}\n" ; $ raw_message .= 'Content-Type: multipart/alternative; boundary="alt-' . $ boundary . '"' . "\n" ; if ( strlen ( $ this -> _body ) > 0 ) { $ raw_message .= "\n--alt-{$boundary}\n" ; $ raw_message .= 'Content-Type: text/plain; charset="' . $ this -> _charset . '"' . "\n\n" ; $ raw_message .= $ this -> _body . "\n" ; } if ( strlen ( $ this -> _htmlBody ) > 0 ) { $ raw_message .= "\n--alt-{$boundary}\n" ; $ raw_message .= 'Content-Type: text/html; charset="' . $ this -> _charset . '"' . "\n\n" ; $ raw_message .= $ this -> _htmlBody . "\n" ; } $ raw_message .= "\n--alt-{$boundary}--\n" ; foreach ( $ this -> _attachments as $ attachment ) { $ raw_message .= "\n--{$boundary}\n" ; $ raw_message .= 'Content-Type: ' . $ attachment [ 'mimeType' ] . '; name="' . $ attachment [ 'name' ] . '"' . "\n" ; if ( ! empty ( $ attachment [ 'contentId' ] ) ) { $ raw_message .= 'Content-ID' . $ attachment [ 'contentId' ] . "\n" ; } $ raw_message .= 'Content-Transfer-Encoding: base64' . "\n" ; $ raw_message .= "\n" . chunk_split ( base64_encode ( $ attachment [ 'data' ] ) , 76 , "\n" ) . "\n" ; } $ raw_message .= "\n--{$boundary}--\n" ; return base64_encode ( $ raw_message ) ; }
Build raw envelope.

@return string
Build raw envelope .