Use attachment_dir only at the point where we're actually
[squirrelmail.git] / functions / mailbox_display.php
index b54905c838d8cf90926c7493519bb26732ad6346..2730e1234d54ebc021bdfc453ed7c2454beb8490 100644 (file)
@@ -1538,8 +1538,10 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
             $body = implode('', $body_a);
             $body .= "\r\n";
 
+            global $username, $attachment_dir;
             $filename = sq_get_attach_tempfile();
-            $fp = fopen($filename, 'wb');
+            $fullpath = getHashedDir($username, $attachment_dir) . '/' . $filename;
+            $fp = fopen($fullpath, 'wb');
             fwrite ($fp, $body);
             fclose($fp);