Updated changelog and todo, working on saving sent
[squirrelmail.git] / functions / smtp.php
index 28a2204a4cdeade21f2f29262567e350d294b8f0..75af97bbe1c477a045e77c7bedd78052e0736c03 100644 (file)
    function write822Header ($fp, $t, $c, $b, $subject) {
       global $REMOTE_ADDR, $SERVER_NAME, $REMOTE_PORT;
       global $data_dir, $username, $domain, $version, $useSendmail;
+      global $default_charset;
 
       // Storing the header to make sure the header is the same
       // everytime the header is printed.
             $header .= mimeBoundary();
             $header .= "\"\r\n";
          } else {
-            $header .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
+            if ($default_charset != "")
+               $header .= "Content-Type: text/plain; charset=$default_charset\r\n";
+            else
+               $header .= "Content-Type: text/plain;\r\n";
             $header .= "Content-Transfer-Encoding: 8bit\r\n";
          }
          $header .= "\r\n"; // One blank line to separate header and body
 
    // Send the body
    function writeBody ($fp, $passedBody) {
+      global $default_charset;
+
       $attachmentlength = 0;
       
       if (isMultipart()) {
          $body = "--".mimeBoundary()."\r\n";
-         $body .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
+
+         if ($default_charset != "")
+            $body .= "Content-Type: text/plain; charset=$default_charset\r\n";
+         else 
+            $body .= "Content-Type: text/plain\r\n";
+
          $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
          $body .= stripslashes($passedBody) . "\r\n";
          fputs ($fp, $body);
 
-         $attachmentlenght = attachFiles($fp);
+         $attachmentlength = attachFiles($fp);
 
          $postbody .= "\r\n--".mimeBoundary()."--\r\n\r\n";
          fputs ($fp, $postbody);
 
    function sendMessage($t, $c, $b, $subject, $body) {
       global $useSendmail;
-      global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress;
+      global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress, $imapPort;
 
       if ($useSendmail==true) {  
          $length = sendSendmail($t, $c, $b, $subject, $body);
       // This is a proposed interface to save messages in the sent folder
       //  -- gustavf
       //
-      // $imap_stream = sqimap_login($username, $key, $imapServerAddress, 1);
-      // sqimap_append ($imap_stream, $sent_folder, $length);
-      // write822Header ($imap_stream, .....);
-      // writeBody ($imap_stream, ....);
-      // sqimap_append_done($imap_stream);
+//      $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
+//      sqimap_append ($imap_stream, $sent_folder, $length);
+//      write822Header ($imap_stream, $t, $c, $b, $subject);
+//      writeBody ($imap_stream, $body); 
+      //sqimap_append_done($imap_stream);
       //
       // Or something like that...