getMessageHeaders example

$buffer = fread($stream, 78);
            $headers .= $buffer;

            // Detect ending of header list             if (preg_match('/(\r\n\r\n|\n\n)/', $headers$match)) {
                $headersPosEnd = strpos($headers$headerBodySeparator = $match[0]);

                break;
            }
        }

        $headers = $this->getMessageHeaders(trim(substr($headers, 0, $headersPosEnd)));

        fseek($stream$headersPosEnd + \strlen($headerBodySeparator));

        return new SMimePart($this->getStreamIterator($stream)$type$subtype$this->getParametersFromHeader($headers['content-type']));
    }

    protected function getStreamIterator($stream): iterable
    {
        while (!feof($stream)) {
            yield str_replace("\n", "\r\n", str_replace("\r\n", "\n", fread($stream, 16372)));
        }
    }
$buffer = fread($stream, 78);
            $headers .= $buffer;

            // Detect ending of header list             if (preg_match('/(\r\n\r\n|\n\n)/', $headers$match)) {
                $headersPosEnd = strpos($headers$headerBodySeparator = $match[0]);

                break;
            }
        }

        $headers = $this->getMessageHeaders(trim(substr($headers, 0, $headersPosEnd)));

        fseek($stream$headersPosEnd + \strlen($headerBodySeparator));

        return new SMimePart($this->getStreamIterator($stream)$type$subtype$this->getParametersFromHeader($headers['content-type']));
    }

    protected function getStreamIterator($stream): iterable
    {
        while (!feof($stream)) {
            yield str_replace("\n", "\r\n", str_replace("\r\n", "\n", fread($stream, 16372)));
        }
    }
Home | Imprint | This part of the site doesn't use cookies.