Commented where more workarounds were added
[squirrelmail.git] / functions / smtp.php
index 56524653dc73274648359d67adc090b31ee287b2..9ec78632da8503cd5c4423c9afdc0d3c9172af49 100644 (file)
 
          $attachmentlength = attachFiles($fp);
 
+         if (!isset($postbody)) $postbody = "";
          $postbody .= "\r\n--".mimeBoundary()."--\r\n\r\n";
          fputs ($fp, $postbody);
       } else {
 
       $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
 
-      if ($reply_id) {
+      // The trim() is a workaround for RedHat's PHP 4.0.4pl1-3
+      // Possibly is there to make Konq work.
+      if ($reply_id = trim($reply_id)) {
          sqimap_mailbox_select ($imap_stream, $mailbox);
          sqimap_messages_flag ($imap_stream, $reply_id, $reply_id, 'Answered');
 
       $body = ereg_replace("\r\n", "\n", $body);
       $body = ereg_replace("\n", "\r\n", $body);
       
-      // Make sure that $t does not contain newlines.
-      $t = ereg_replace("[\n|\r]", "", $t);
-
       if ($useSendmail) {
          $length = sendSendmail($t, $c, $b, $subject, $body, $more_headers);
       } else {
          $length = sendSMTP($t, $c, $b, $subject, $body, $more_headers);
       }
 
+      // The trim() is a workaround for RedHat's PHP 4.0.4pl1-3
+      // Possibly is there to make Konq work.
+      $sent_folder = trim($sent_folder);
       if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
          sqimap_append ($imap_stream, $sent_folder, $length);
          write822Header ($imap_stream, $t, $c, $b, $subject, $more_headers);