Added MUCH better composing
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Dec 1999 19:24:54 +0000 (19:24 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Dec 1999 19:24:54 +0000 (19:24 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@57 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/config.php
functions/mailbox.php
functions/mailbox_display.php
functions/smtp.php [new file with mode: 0644]
functions/strings.php
src/compose.php
src/compose_send.php [new file with mode: 0644]
src/read_body.php

index 87b93b17c6cec1114eb365ff71900b8a3605f7ec..a4a5cde4511576ad5d01b0fcb6074aecd34eeee8 100644 (file)
@@ -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 <A HREF=\"mailto:nathan@usa.om.org\">Nathan</A> or <A HREF=\"mailto:luke@usa.om.org\">Luke</A>.";
index 44ea499de34d6f33af0f8cc70fba90cb7691e57c..f3ea7dbcf7bbdbe38e8681b204047d7f0de95163 100644 (file)
       $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(" ", "&nbsp;", $line);
       $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $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;
index d039cbc1e708dd81755bc1a6a7d387fb8bd233d5..98a4ce0b1d5ede09ba7b07f5b8e398f5cc134496 100644 (file)
@@ -16,7 +16,7 @@
          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";
diff --git a/functions/smtp.php b/functions/smtp.php
new file mode 100644 (file)
index 0000000..bf83ab7
--- /dev/null
@@ -0,0 +1,47 @@
+<?
+   /** 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
index 422c012472c967fb9b7f01169f62b0ccab1e8620..d00cd835e5bb34e242ab3f55307950dc5b25e53f 100644 (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;
    }
index 60c40421e1fafaa4c54eb3bdff5bed451b89b9d0..e78c515b6b3e4bfacc92069aabcdc505389b432a 100644 (file)
    $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
diff --git a/src/compose_send.php b/src/compose_send.php
new file mode 100644 (file)
index 0000000..c9043a3
--- /dev/null
@@ -0,0 +1,10 @@
+<?
+   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
index 4f7e458a23aa4e99aa6a0b9452a0ee7505f876d6..e8bb590bf5370b1aa2b8d913afe0bf95753716a3 100644 (file)
@@ -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]);