Browse Source

fixed the problem with no attachments

Luke Ehresman 25 years ago
parent
commit
16117bd1ac
1 changed files with 7 additions and 6 deletions
  1. 7 6
      functions/imap_messages.php

+ 7 - 6
functions/imap_messages.php

@@ -118,12 +118,12 @@
     ******************************************************************************/
     ******************************************************************************/
    function sqimap_get_header ($imap_stream, $read) {
    function sqimap_get_header ($imap_stream, $read) {
       $i = 0;
       $i = 0;
+      // Set up some defaults
+      $header["TYPE0"] = "text";
+      $header["TYPE1"] = "plain";
+      $header["CHARSET"] = "us-ascii";
+
       while ($i < count($read)) {
       while ($i < count($read)) {
-         // Set up some defaults
-         $header["TYPE0"] = "text";
-         $header["TYPE1"] = "plain";
-         $header["CHARSET"] = "us-ascii";
-         
          if (substr($read[$i], 0, 17) == "MIME-Version: 1.0") {
          if (substr($read[$i], 0, 17) == "MIME-Version: 1.0") {
             $header["MIME"] = true;
             $header["MIME"] = true;
             $i++;
             $i++;
@@ -136,7 +136,7 @@
          }
          }
 
 
          /** CONTENT-TYPE **/
          /** CONTENT-TYPE **/
-         else if (substr($read[$i], 0, 13) == "Content-Type:") {
+         else if (strtolower(substr($read[$i], 0, 13)) == "content-type:") {
             $cont = strtolower(trim(substr($read[$i], 13)));
             $cont = strtolower(trim(substr($read[$i], 13)));
             if (strpos($cont, ";"))
             if (strpos($cont, ";"))
                $cont = substr($cont, 0, strpos($cont, ";"));
                $cont = substr($cont, 0, strpos($cont, ";"));
@@ -149,6 +149,7 @@
                $header["TYPE0"] = $cont;
                $header["TYPE0"] = $cont;
             }
             }
 
 
+
             $line = $read[$i];
             $line = $read[$i];
             $i++;
             $i++;
             while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
             while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {