Permalink
Browse files

fix #9507 - support Mbox headers with From_WS_ by munging them to ret…

…urn-path:

git-svn-id: http://svn.php.net/repository/pear/packages/Mail_Mime/trunk@316136 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
roojs committed Sep 5, 2011
1 parent c0977a1 commit 946be2d2bacab7af9849674c4e14fde7eb8f5618
Showing with 15 additions and 2 deletions.
  1. +15 −2 mimeDecode.php
View
@@ -450,12 +450,25 @@ function _parseHeaders($input)
$input = preg_replace("/\r\n(\t| )+/", ' ', $input);
$headers = explode("\r\n", trim($input));
-
+ $got_start = false;
foreach ($headers as $value) {
+ if (!$got_start) {
+ // munge headers for mbox style from
+ if ($value[0] == '>') {
+ $value = substring($value, 1); // remove mbox >
+ }
+ if (substr($value,0,5) == 'From ') {
+ $value = 'Return-Path: ' . substr($value, 5);
+ } else {
+ $got_start = true;
+ }
+ }
+
$hdr_name = substr($value, 0, $pos = strpos($value, ':'));
$hdr_value = substr($value, $pos+1);
- if($hdr_value[0] == ' ')
+ if($hdr_value[0] == ' ') {
$hdr_value = substr($hdr_value, 1);
+ }
$return[] = array(
'name' => $hdr_name,

0 comments on commit 946be2d

Please sign in to comment.