From b8ea4ed629e58fb57a4b110867b4e1b84c82610f Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sat, 4 Dec 1999 19:24:54 +0000 Subject: [PATCH] Added MUCH better composing git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@57 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/config.php | 4 +++ functions/mailbox.php | 7 +++--- functions/mailbox_display.php | 2 +- functions/smtp.php | 47 +++++++++++++++++++++++++++++++++++ functions/strings.php | 16 ++++++++++-- src/compose.php | 8 ++++-- src/compose_send.php | 10 ++++++++ src/read_body.php | 1 + 8 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 functions/smtp.php create mode 100644 src/compose_send.php diff --git a/config/config.php b/config/config.php index 87b93b17..a4a5cde4 100644 --- a/config/config.php +++ b/config/config.php @@ -7,6 +7,10 @@ $org_name = "Operation Mobilization"; /* 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 Nathan or Luke."; diff --git a/functions/mailbox.php b/functions/mailbox.php index 44ea499d..f3ea7dbc 100644 --- a/functions/mailbox.php +++ b/functions/mailbox.php @@ -269,6 +269,7 @@ $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); @@ -289,7 +290,8 @@ "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("
", "", $text); if (strpos($link, "&")) $end = strpos($link, "&"); @@ -299,8 +301,7 @@ $end = strlen($link); $link = substr($link, 0, $end); - - $line = str_replace($link, "$link", $line); + $line = str_replace($text, "$text", $line); } return $line; diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index d039cbc1..98a4ce0b 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -16,7 +16,7 @@ echo " \n"; echo " $senderName\n"; echo "
$dateString
\n"; - echo " $subject\n"; + echo " $subject\n"; } else { echo " \n"; echo " $senderName\n"; diff --git a/functions/smtp.php b/functions/smtp.php new file mode 100644 index 00000000..bf83ab71 --- /dev/null +++ b/functions/smtp.php @@ -0,0 +1,47 @@ +"; + $data[$counter] = $read; + $read = fgets($smtpConnection, 1024); + $counter++; + } + } + + function sendMessage($to, $subject, $body) { + echo ""; + $smtpConnection = fsockopen("10.4.1.1", 25, $errorNumber, $errorString); + if (!$smtpConnection) { + echo "Error connecting to SMTP Server.
"; + echo "$errorNumber : $errorString
"; + exit; + } + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + + fputs($smtpConnection, "MAIL FROM:\n"); + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + + fputs($smtpConnection, "RCPT TO:<$to>\n"); + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + + fputs($smtpConnection, "DATA\n"); + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + + fputs($smtpConnection, "Subject: $subject\n"); + fputs($smtpConnection, "$body\n"); + fputs($smtpConnection, ".\n"); + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + + fputs($smtpConnection, "QUIT\n"); + echo htmlspecialchars(fgets($smtpConnection, 1024)) . "
"; + echo "
"; + } +?> \ No newline at end of file diff --git a/functions/strings.php b/functions/strings.php index 422c0124..d00cd835 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -39,9 +39,21 @@ $i++; $line_len = $line_len + strlen($words[$i])+1; } - if ($i < count($words)) // don't
the last line - $line = "$line
"; $line_len = strlen($words[$i])+1; + if ($line_len < $wrap) { + if ($i < count($words)) // don't
the last line + $line = "$line
"; + } 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
"; + } + $line = "$line$endline
"; + $i++; + } } return $line; } diff --git a/src/compose.php b/src/compose.php index 60c40421..e78c515b 100644 --- a/src/compose.php +++ b/src/compose.php @@ -10,8 +10,12 @@ $imapConnection = loginToImapServer($username, $key, $imapServerAddress); displayPageHeader($mailbox); - echo "
\n"; - echo ""; + echo "\n"; + echo "
"; + echo ""; + echo ""; + echo "
"; echo ""; + echo "
"; echo "
"; ?> \ No newline at end of file diff --git a/src/compose_send.php b/src/compose_send.php new file mode 100644 index 00000000..c9043a38 --- /dev/null +++ b/src/compose_send.php @@ -0,0 +1,10 @@ +RETURN"; +?> \ No newline at end of file diff --git a/src/read_body.php b/src/read_body.php index 4f7e458a..e8bb590b 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -13,6 +13,7 @@ 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]); -- 2.25.1