fix for bug #756667
[squirrelmail.git] / src / compose.php
index 3c20980dea2bd70d87bef1adfa13f5bb71161faf..595001939758b5bb03399c981d9e3066082543f8 100644 (file)
@@ -559,7 +559,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
            $use_signature, $composesession, $data_dir, $username,
            $username, $key, $imapServerAddress, $imapPort, $compose_messages,
            $composeMessage;
-       global $languages, $squirrelmail_language;
+    global $languages, $squirrelmail_language;
 
     $send_to = $send_to_cc = $send_to_bcc = $subject = $identity = '';
     $mailprio = 3;
@@ -694,7 +694,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
         case ('forward'):
             $send_to = '';
             $subject = decodeHeader($orig_header->subject,false,true);
-           if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
+            if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
                 (substr(strtolower($subject), 0, 5) != '[fwd:') &&
                 (substr(strtolower($subject), 0, 6) != '[ fwd:')) {
                 $subject = '[Fwd: ' . $subject . ']';
@@ -1337,6 +1337,15 @@ function deliverMessage($composeMessage, $draft=false) {
            $domain, $action, $default_move_to_sent, $move_to_sent;
     global $imapServerAddress, $imapPort, $sent_folder, $key;
 
+    /* some browsers replace <space> by nonbreaking spaces &nbsp;
+       by replacing them back to spaces addressparsing works */
+    /* FIXME: How to handle in case of other charsets where "\240"
+       is not a non breaking space ??? */
+        
+    $send_to = str_replace("\240",' ',$send_to);
+    $send_to_cc = str_replace("\240",' ',$send_to_cc);
+    $send_to_bcc = str_replace("\240",' ',$send_to_bcc);
+
     $rfc822_header = $composeMessage->rfc822_header;
 
     $abook = addressbook_init(false, true);
@@ -1425,11 +1434,10 @@ function deliverMessage($composeMessage, $draft=false) {
         } else {    
             $rfc822_header->encoding = '8bit';
         }            
-    }
-    if ($default_charset) {
-        $content_type->properties['charset']=$default_charset;
-    }
-        
+        if ($default_charset) {
+            $content_type->properties['charset']=$default_charset;
+        }
+    }        
     $rfc822_header->content_type = $content_type;
     $composeMessage->rfc822_header = $rfc822_header;