fix parser and add attachment support

This commit is contained in:
Andreas Schamberger
2012-01-03 16:38:50 +01:00
parent e151d06371
commit f6ea609f46
4 changed files with 80 additions and 5 deletions

View File

@ -49,7 +49,7 @@ class Parser
}
$content = '';
$currentPart = $multipart;
$lines = preg_split("/\r\n|\n/", $mimeMessage);
$lines = preg_split("/(\r\n)/", $mimeMessage);
foreach ($lines as $line) {
// ignore http status code and POST *
if (substr($line, 0, 5) == 'HTTP/' || substr($line, 0, 4) == 'POST') {
@ -74,7 +74,7 @@ class Parser
unset($currentHeader);
}
if ($inHeader) {
if ($line == '') {
if (trim($line) == '') {
$inHeader = false;
continue;
}
@ -111,7 +111,7 @@ class Parser
}
} else {
if ($hitFirstBoundary === false) {
if ($line != '') {
if (trim($line) != '') {
$inHeader = true;
$currentHeader = $line;
continue;
@ -120,7 +120,6 @@ class Parser
$content .= $line . "\r\n";
}
}
}
return $multipart;
}