$motd = " Welcome to OM's webmail system, SquirrelMail. We are currently in beta, and have not yet released a full version of SquirrelMail. Please feel free to look around, and please report any bugs to <A HREF=\"mailto:nathan@usa.om.org\">Nathan</A> or <A HREF=\"mailto:luke@usa.om.org\">Luke</A>.";
// Customizable colors
+/*
+ // Standard Colors
$color[0] = "DCDCDC"; // Light Gray
$color[1] = "800000"; // Red
$color[2] = "CC0000"; // Light Red
$color[9] = "ABABAB"; // Darker light gray
$color[10] = "666666"; // Darker light gray
$color[11] = "770000"; // Special folder color
+*/
+ // TAN THEME
+ $color[0] = "C7B289"; // Light Gray
+ $color[1] = "800000"; // Red
+ $color[2] = "CC0000"; // Light Red
+ $color[3] = "B79878"; // Left Background
+ $color[4] = "FBE1BC"; // Background
+ $color[5] = "FFFFCC"; // Light Yellow
+ $color[6] = "000000"; // Left Text
+ $color[7] = "AF5523"; // Link
+ $color[8] = "000000"; // Text
+ $color[9] = "ABABAB"; // Darker light gray
+ $color[10] = "666666"; // Darker light gray
+ $color[11] = "770000"; // Special folder color
+
// Whether or not to use $color[11] for special folders. If not, special
// folders will be the same color as the other folders
} else {
$rel_end = $end;
}
- fputs($imapConnection, "messageFetch FETCH $rel_start:$rel_end RFC822.HEADER.LINES (From Subject Date To Cc)\n");
+ fputs($imapConnection, "messageFetch FETCH $rel_start:$rel_end RFC822.HEADER.LINES (From Subject Date)\n");
$read = fgets($imapConnection, 1024);
while ((substr($read, 0, 15) != "messageFetch OK") && (substr($read, 0, 16) != "messageFetch BAD")) {
$cont = strtolower(trim(substr($read, 13)));
if (strpos($cont, ";"))
$cont = substr($cont, 0, strpos($cont, ";"));
- $header["TYPE0"] = substr($cont, 0, strpos($cont, "/"));
- $header["TYPE1"] = substr($cont, strpos($cont, "/")+1);
+
+ if (strpos($cont, "/")) {
+ $header["TYPE0"] = substr($cont, 0, strpos($cont, "/"));
+ $header["TYPE1"] = substr($cont, strpos($cont, "/")+1);
+ } else {
+ $header["TYPE0"] = $cont;
+ }
$line = $read;
$read = fgets($imapConnection, 1024);
}
/** REPLY-TO **/
- else if (substr($read, 0, 9) == "Reply-To:") {
+ else if (strtolower(substr($read, 0, 9)) == "reply-to:") {
$header["REPLYTO"] = trim(substr($read, 9, strlen($read)));
$read = fgets($imapConnection, 1024);
}
/** FROM **/
- else if (substr($read, 0, 5) == "From:") {
+ else if (strtolower(substr($read, 0, 5)) == "from:") {
$header["FROM"] = trim(substr($read, 5, strlen($read) - 6));
if ($header["REPLYTO"] == "")
$header["REPLYTO"] = $header["FROM"];
$read = fgets($imapConnection, 1024);
}
/** DATE **/
- else if (substr($read, 0, 5) == "Date:") {
+ else if (strtolower(substr($read, 0, 5)) == "date:") {
$d = substr($read, 5, strlen($read) - 6);
$d = trim($d);
$d = ereg_replace(" ", " ", $d);
$read = fgets($imapConnection, 1024);
}
/** SUBJECT **/
- else if (substr($read, 0, 8) == "Subject:") {
+ else if (strtolower(substr($read, 0, 8)) == "subject:") {
$header["SUBJECT"] = trim(substr($read, 8, strlen($read) - 9));
if (strlen(Chop($header["SUBJECT"])) == 0)
$header["SUBJECT"] = "(no subject)";
$read = fgets($imapConnection, 1024);
}
/** CC **/
- else if (substr($read, 0, 3) == "CC:") {
+ else if (strtolower(substr($read, 0, 3)) == "cc:") {
$pos = 0;
$header["CC"][$pos] = trim(substr($read, 4));
$read = fgets($imapConnection, 1024);
}
}
/** TO **/
- else if (substr($read, 0, 3) == "To:") {
+ else if (strtolower(substr($read, 0, 3)) == "to:") {
$pos = 0;
$header["TO"][$pos] = trim(substr($read, 4));
$read = fgets($imapConnection, 1024);
$cont = strtolower(trim(substr($read[$i], 13)));
if (strpos($cont, ";"))
$cont = substr($cont, 0, strpos($cont, ";"));
- $type0 = substr($cont, 0, strpos($cont, "/"));
- $type1 = substr($cont, strpos($cont, "/")+1);
+
+ if (strpos($cont, "/")) {
+ $type0 = substr($cont, 0, strpos($cont, "/"));
+ $type1 = substr($cont, strpos($cont, "/")+1);
+ } else {
+ $type0 = $cont;
+ }
$line = $read[$i];
while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
$line = str_replace(" ", " ", $line);
$line = str_replace("\t", " ", $line);
+ $line = str_replace("\n", "", $line);
/** if >> or > are found at the beginning of a line, I'll assume that was
replied text, so make it different colors **/
function decodeMime($body, $bound, $type0, $type1) {
- echo "$type0/$type1<BR>";
+// echo "$type0/$type1<BR>";
if ($type0 == "multipart") {
if ($body[0] == "")
$i = 1;
/** This gets one entity's properties **/
function getEntity($body, $bound, $type0, $type1, $encoding, $charset) {
- echo "$type0/$type1<BR>";
+// echo "--$type0/$type1--<BR>";
$msg[0]["TYPE0"] = $type0;
$msg[0]["TYPE1"] = $type1;
$msg[0]["ENCODING"] = $encoding;
$msg[0]["CHARSET"] = $charset;
if ($type0 == "text") {
+ // error correcting if they didn't follow RFC standards
+ if (trim($type1) == "")
+ $type1 = "plain";
+
if ($type1 == "plain") {
$msg[0]["PRIORITY"] = 10;
for ($p = 0;$p < count($body);$p++) {
$msg[0]["BODY"][$p] = $body[$q];
}
}
- } else if ($type0 == "image") {
- $msg[0]["BODY"][0] = "<B><FONT COLOR=DD0000>This is an image. Squirrelmail currently cannot decode images.</FONT></B>";
} else {
$msg[0]["BODY"][0] = "<B><FONT COLOR=DD0000>This attachment is of an unknown format: $type0/$type1</FONT></B>";
}
break;
}
}
+
+ for ($i = 0; $i < count($message["ENTITIES"]); $i++) {
+ $pos = count($body);
+ if ($message["ENTITIES"][$i]["TYPE0"] != "text") {
+ $body[$pos] = "<BR><TT><U><B>ATTACHMENTS:</B></U></TT><BR>";
+ }
+ }
+
+ for ($i = 0; $i < count($message["ENTITIES"]); $i++) {
+ $pos = count($body);
+ if ($message["ENTITIES"][$i]["TYPE0"] != "text") {
+ if ($message["ENTITIES"][$i]["TYPE0"] == "image") {
+ $body[$pos] = "<TT> Image: " . strtoupper($message["ENTITIES"][$i]["TYPE1"]) . "</TT><BR>";
+ } else {
+ $body[$pos] = "<TT> Unknown Type: " . $message["ENTITIES"][$i]["TYPE0"] . "/" . $message["ENTITIES"][$i]["TYPE1"] . "</TT><BR>";
+ }
+ }
+ }
+
return $body;
}
/** Lets start sending the actual message */
fputs($smtpConnection, "DATA\n");
fputs($smtpConnection, "Subject: $subject\n"); // Subject
+ fputs($smtpConnection, "From: <$from>\n"); // Subject
fputs($smtpConnection, "To: <$to_list>\n"); // Who it's TO
if ($cc_list) {
fputs($smtpConnection, "Cc: <$cc_list>\n"); // Who the CCs are
fputs($smtpConnection, "X-Mailer: SquirrelMail (version $version)\n"); // Identify SquirrelMail
fputs($smtpConnection, "Reply-To: $from\n");
fputs($smtpConnection, "MIME-Version: 1.0\n");
- fputs($smtpConnection, "Content-Type: text/plain; charset=us-ascii\n");
+ fputs($smtpConnection, "Content-Type: text\n");
fputs($smtpConnection, "$body\n"); // send the body of the message
fputs($smtpConnection, ".\n"); // end the DATA part