Commented where more workarounds were added
[squirrelmail.git] / functions / smtp.php
index b0b922f2f15327deb357de525d9665ee4e38121e..9ec78632da8503cd5c4423c9afdc0d3c9172af49 100644 (file)
 
          $attachmentlength = attachFiles($fp);
 
+         if (!isset($postbody)) $postbody = "";
          $postbody .= "\r\n--".mimeBoundary()."--\r\n\r\n";
          fputs ($fp, $postbody);
       } else {
       global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress, $imapPort;
       $more_headers = Array();
 
-      // added as just a precaution (Luke: 1.0.1)
-      $t = trim($t);
-      $c = trim($c);
-      $b = trim($b);
-      $subject = trim($subject);
-      $body = trim($body);
-      $mailbox = trim($mailbox);
-      $sent_folder = trim($sent_folder);
-
       $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');
 
          $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);