Redaxscript\Mailer::_createHeaderString PHP Method

_createHeaderString() protected method

create the header contents
Since: 2.0.0
protected _createHeaderString ( )
    protected function _createHeaderString()
    {
        /* collect header string */
        $this->_headerString = 'MIME-Version: 1.0' . PHP_EOL;
        /* empty attachment */
        if (!$this->_attachmentArray) {
            $this->_headerString .= 'Content-Type: text/html; charset=' . Db::getSetting('charset') . PHP_EOL;
        } else {
            foreach ($this->_attachmentArray as $file => $content) {
                $content = chunk_split(base64_encode($content));
                $boundary = uniqid();
                $this->_headerString .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . PHP_EOL . PHP_EOL;
                $this->_headerString .= '--' . uniqid() . PHP_EOL;
                /* integrate body string */
                if ($this->_bodyString) {
                    $this->_headerString .= 'Content-Type: text/html; charset=' . Db::getSetting('charset') . PHP_EOL;
                    $this->_headerString .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL;
                    $this->_headerString .= $this->_bodyString . PHP_EOL . PHP_EOL;
                    $this->_headerString .= '--' . $boundary . PHP_EOL;
                    /* reset body string */
                    $this->_bodyString = null;
                }
                $this->_headerString .= 'Content-Type: application/octet-stream; name="' . $file . '"' . PHP_EOL;
                $this->_headerString .= 'Content-Transfer-Encoding: base64' . PHP_EOL;
                $this->_headerString .= 'Content-Disposition: attachment; filename="' . $file . '"' . PHP_EOL . PHP_EOL;
                $this->_headerString .= $content . PHP_EOL . PHP_EOL;
                $this->_headerString .= '--' . $boundary . '--';
            }
        }
        /* collect from output */
        $this->_headerString .= 'From: ' . $this->_fromString . PHP_EOL;
        $this->_headerString .= 'Reply-To: ' . $this->_fromString . PHP_EOL;
        $this->_headerString .= 'Return-Path: ' . $this->_fromString . PHP_EOL;
    }