From ce46dc40d6a90be8bef676ffd885d70db2bff969 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 13 Aug 2012 16:34:51 +0000 Subject: [PATCH] some servers seem to sent their responses for the content not with the first EXT section, so we loop through the parsed response until we find some matching content --- egw-pear/Net/IMAP.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/egw-pear/Net/IMAP.php b/egw-pear/Net/IMAP.php index bd2294de30..1372a26ae0 100644 --- a/egw-pear/Net/IMAP.php +++ b/egw-pear/Net/IMAP.php @@ -592,7 +592,12 @@ class Net_IMAP extends Net_IMAPProtocol { if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); } - $ret=$ret["PARSED"][0]["EXT"]["BODY[$partId]"]["CONTENT"]; + $found = 0; + foreach($ret["PARSED"] as $key => $value) + { + if (isset($ret["PARSED"][$key]["EXT"]["BODY[$partId]"]["CONTENT"])) {$found = $key; break;} + } + $ret=$ret["PARSED"][$found]["EXT"]["BODY[$partId]"]["CONTENT"]; //$ret=$resp["PARSED"][0]["EXT"]["RFC822"]["CONTENT"]; return $ret; } @@ -1874,6 +1879,7 @@ class Net_IMAP extends Net_IMAPProtocol { if (PEAR::isError($ret)) { return $ret; } + if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); }