/* The server that your imap server is on */
$imapServerAddress = "adam.usa.om.org";
+$imapPort = 143;
+
+$smtpServerAddress = "adam.usa.om.org";
+$smtpPort = 25;
/* This is displayed right after they log in */
$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>.";
$wrap_at = 80; // Make this configurable int the config file some time
if (strlen($line) - 2 >= $wrap_at) // -2 because of the ^^ at the beginning
$line = wordWrap($line, $wrap_at);
+
$line = str_replace(" ", " ", $line);
$line = str_replace("\t", " ", $line);
"www" and "mailto" also. That should probably be added later. **/
if (strpos(strtolower($line), "http://") != false) {
$start = strpos(strtolower($line), "http://");
- $link = substr($line, $start, strlen($line));
+ $text = substr($line, $start, strlen($line));
+ $link = ereg_replace("<BR>", "", $text);
if (strpos($link, "&"))
$end = strpos($link, "&");
$end = strlen($link);
$link = substr($link, 0, $end);
-
- $line = str_replace($link, "<A HREF=\"$link\" TARGET=_top>$link</A>", $line);
+ $line = str_replace($text, "<A HREF=\"$link\" TARGET=_top>$text</A>", $line);
}
return $line;
echo " <TD><FONT FACE=\"Arial,Helvetica\"><nobr><B><input type=checkbox name=\"msg[$t]\" value=$i></B></nobr></FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\"><B>$senderName</B></FONT></TD>\n";
echo " <TD><CENTER><B><FONT FACE=\"Arial,Helvetica\">$dateString</FONT></B></CENTER></TD>\n";
- echo " <TD><FONT FACE=\"Arial,Helvetica\"><B><A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$i\">$subject</A></B></FONT></TD>\n";
+ echo " <TD><FONT FACE=\"Arial,Helvetica\"><B><A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$i&sort=$sort&startMessage=$startMessage\">$subject</A></B></FONT></TD>\n";
} else {
echo " <TD><FONT FACE=\"Arial,Helvetica\"><nobr><input type=checkbox name=\"msg[$t]\" value=$i></nobr></FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\">$senderName</FONT></TD>\n";
--- /dev/null
+<?
+ /** smtp.php
+ **
+ ** This contains all the functions needed to send messages through
+ ** an smtp server.
+ **/
+
+ function smtpReadData($smtpConnection) {
+ $read = fgets($smtpConnection, 1024);
+ $counter = 0;
+ while ($read) {
+ echo $read . "<BR>";
+ $data[$counter] = $read;
+ $read = fgets($smtpConnection, 1024);
+ $counter++;
+ }
+ }
+
+ function sendMessage($to, $subject, $body) {
+ echo "<FONT FACE=\"Arial,Helvetica\">";
+ $smtpConnection = fsockopen("10.4.1.1", 25, $errorNumber, $errorString);
+ if (!$smtpConnection) {
+ echo "Error connecting to SMTP Server.<br>";
+ echo "$errorNumber : $errorString<br>";
+ exit;
+ }
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+
+ fputs($smtpConnection, "MAIL FROM:<luke@usa.om.org>\n");
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+
+ fputs($smtpConnection, "RCPT TO:<$to>\n");
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+
+ fputs($smtpConnection, "DATA\n");
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+
+ fputs($smtpConnection, "Subject: $subject\n");
+ fputs($smtpConnection, "$body\n");
+ fputs($smtpConnection, ".\n");
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+
+ fputs($smtpConnection, "QUIT\n");
+ echo htmlspecialchars(fgets($smtpConnection, 1024)) . "<BR>";
+ echo "</FONT>";
+ }
+?>
\ No newline at end of file
$i++;
$line_len = $line_len + strlen($words[$i])+1;
}
- if ($i < count($words)) // don't <BR> the last line
- $line = "$line<BR>";
$line_len = strlen($words[$i])+1;
+ if ($line_len < $wrap) {
+ if ($i < count($words)) // don't <BR> the last line
+ $line = "$line<BR>";
+ } else {
+ $endline = $words[$i];
+ while ($line_len >= $wrap) {
+ $bigline = substr($endline, 0, $wrap);
+ $endline = substr($endline, $wrap, strlen($endline));
+ $line_len = strlen($endline);
+ $line = "$line$bigline<BR>";
+ }
+ $line = "$line$endline<BR>";
+ $i++;
+ }
}
return $line;
}
$imapConnection = loginToImapServer($username, $key, $imapServerAddress);
displayPageHeader($mailbox);
- echo "<FORM action=\"mailto:luke@usa.om.org\" METHOD=POST>\n";
- echo "<TEXTAREA NAME=body ROWS=20 COLS=82></TEXTAREA>";
+ echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
+ echo "<CENTER>";
+ echo "<INPUT TYPE=TEXT NAME=passed_to>";
+ echo "<INPUT TYPE=TEXT NAME=passed_subject>";
+ echo "<TEXTAREA NAME=passed_body ROWS=20 COLS=72 WRAP=SOFT></TEXTAREA><BR>";
echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
+ echo "</CENTER>";
echo "</FORM>";
?>
\ No newline at end of file
--- /dev/null
+<?
+ include("../config/config.php");
+ include("../functions/strings.php");
+ include("../functions/page_header.php");
+ include("../functions/mailbox.php");
+ include("../functions/smtp.php");
+
+ sendMessage($passed_to, $passed_subject, $passed_body);
+ echo "<A HREF=\"right_main.php\">RETURN</A>";
+?>
\ No newline at end of file
displayPageHeader($mailbox);
$body = fetchBody($imapConnection, $passed_id);
getMessageHeaders($imapConnection, $passed_id, $passed_id, $f, $s, $d);
+// setMessageFlag($imapConnection, $passed_id, $passed_id, "Seen");
$subject = $s[0];
$d[0] = ereg_replace(" ", " ", $d[0]);