Attachments now opened with binary flag, for windows compatibility
[squirrelmail.git] / src / compose.php
index e9e1d35498a9ef6f7555fdbca5b4f4bc284bb0a6..d130c06f2d568bd6b2b8f05589f4eecc12863550 100644 (file)
@@ -645,7 +645,7 @@ function getAttachments($message, $session, $passed_id, $entities, $imapConnecti
             $newAttachment['session'] = $session;
 
             /* Write Attachment to file */
-            $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w');
+            $fp = fopen ("$hashed_attachment_dir/$localfilename", 'wb');
             fputs($fp, decodeBody(mime_fetch_body($imapConnection,
                   $passed_id, $message->entity_id),
                   $message->header->encoding));
@@ -684,7 +684,7 @@ function getMessage_RFC822_Attachment($message, $session, $passed_id,
         $localfilename = GenerateRandomString(32, 'FILE', 7);
         $full_localfilename = "$hashed_attachment_dir/$localfilename";
             
-        $fp = fopen( $full_localfilename, 'w');
+        $fp = fopen( $full_localfilename, 'wb');
         fwrite ($fp, $body);
         fclose($fp);
         $newAttachment = array();
@@ -993,9 +993,9 @@ function checkInput ($show) {
      * using $show=false, and then when i'm ready to display the error
      * message, show=true
      */
-    global $body, $send_to, $subject, $color;
+    global $body, $send_to, $send_to_bcc, $subject, $color;
 
-    if ($send_to == '') {
+    if ($send_to == '' && $send_to_bcc == '') {
         if ($show) {
             plain_error_message(_("You have not filled in the \"To:\" field."), $color);
         }
@@ -1103,4 +1103,4 @@ function getReplyCitation($orig_from)
     return ($start . $orig_from . $end . "\n");
 }
 
-?>
\ No newline at end of file
+?>