runs message through sqWordWrap before putting it in compose area on reply
[squirrelmail.git] / src / compose.php
index bcc27970953e93370216ac6e753cd33ff8c02740..48e7087aa43571262ad553cbc391d465abb58bc0 100644 (file)
@@ -41,7 +41,7 @@
    // This function is used when not sending or adding attachments
    function newMail () {
       global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
-         $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc;
+         $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size;
 
       $send_to = sqStripSlashes(decodeHeader($send_to));
       $send_to_cc = sqStripSlashes(decodeHeader($send_to_cc));
          if ($message->header->type1 == "html")
             $body = strip_tags($body);
             
+         $body_ary = explode("\n", $body);
+         $body = "";
+         for ($i=0; $i < count($body_ary); $i++) {
+            sqWordWrap($body_ary[$i], $editor_size - 1);
+            $body .= $body_ary[$i];
+         }
+         $body_ary = array();
          $body_ary = explode("\n", $body);
          $body = "";
          for ($i=0; $i < count($body_ary); $i++) {
             else
                $body = "$body> $tmp\n";
          }
+
          sqimap_mailbox_close($imapConnection);
          return $body;   
       }