$read = fgets ($imap_stream, 10000);
$response = substr($read, 0, 4);
}
- $read = strtolower($bodystructure);
+ // $read = strtolower($bodystructure);
+ $read = $bodystructure;
- if ($debug_mime) echo "<tt>$read</tt><br><br>";
+ if ($debug_mime) echo "<tt>$read</tt><br><br>\n";
// isolate the body structure and remove beginning and end parenthesis
- $read = trim(substr ($read, strpos($read, "bodystructure") + 13));
+ $read = trim(substr ($read, strpos(strtolower($read), "bodystructure") + 13));
$read = trim(substr ($read, 0, -1));
$end = mime_match_parenthesis(0, $read);
while ($end == strlen($read)-1) {
$end = mime_match_parenthesis(0, $read);
}
- if ($debug_mime) echo "<tt>$read</tt><br><br>";
+ if ($debug_mime) echo "<tt>$read</tt><br><br>\n";
$msg = mime_parse_structure ($read, 0);
$msg->header = $header;
// to mime_get_elements()
function mime_parse_structure ($structure, $ent_id) {
global $debug_mime;
- if ($debug_mime) echo "<font color=008800><tt>START: mime_parse_structure()</tt></font><br>";
+ if ($debug_mime) echo "<font color=008800><tt>START: mime_parse_structure()</tt></font><br>\n";
$msg = new message();
if (substr($structure, 0, 1) == "(") {
$ent_id = mime_new_element_level($ent_id);
$structure = trim($structure);
$char = substr($structure, 0, 1);
- if (substr($structure, 0, 3) == "nil") {
+ if (strtolower(substr($structure, 0, 3)) == "nil") {
$text = "";
$structure = substr($structure, 3);
} else if ($char == "\"") {
// This is where all the text parts get put into the header
switch ($elem_num) {
case 1:
- $msg->header->type0 = $text;
- if ($debug_mime) echo "<tt>type0 = $text</tt><br>";
+ $msg->header->type0 = strtolower($text);
+ if ($debug_mime) echo "<tt>type0 = ".strtolower($text)."</tt><br>";
break;
case 2:
- $msg->header->type1 = $text;
- if ($debug_mime) echo "<tt>type1 = $text</tt><br>";
+ $msg->header->type1 = strtolower($text);
+ if ($debug_mime) echo "<tt>type1 = ".strtolower($text)."</tt><br>";
break;
case 5:
$msg->header->description = $text;
if ($debug_mime) echo "<tt>description = $text</tt><br>";
break;
case 6:
- $msg->header->encoding = $text;
- if ($debug_mime) echo "<tt>encoding = $text</tt><br>";
+ $msg->header->encoding = strtolower($text);
+ if ($debug_mime) echo "<tt>encoding = ".strtolower($text)."</tt><br>";
break;
case 7:
$msg->header->size = $text;
$structure = trim(substr($structure, strlen($tmp) + 2));
$k = count($props);
- $props[$k]["name"] = $tmp;
+ $props[$k]["name"] = strtolower($tmp);
$props[$k]["value"] = $value;
} else if ($char == "(") {
$end = mime_match_parenthesis (0, $structure);