X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fsmtp.php;h=0c66f44e96779aecea0d956e03ef2925b49ed5d9;hb=f972eb466c6678220bd89b217d7904ce7ae3072e;hp=4c15c2c96f6c2d2cc6f40edd21a0e189d5d3a736;hpb=b4338e6716ea0e3b47ee2d0acd0dd2eaf6ba7290;p=squirrelmail.git diff --git a/functions/smtp.php b/functions/smtp.php index 4c15c2c9..0c66f44e 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -62,27 +62,22 @@ $length = 0; if (isMultipart()) { - reset($attachments); - while (list($localname, $remotename) = each($attachments)) { - // This is to make sure noone is giving a filename in another - // directory - $localname = ereg_replace ("\\/", '', $localname); - - $fileinfo = fopen ($attachment_dir.$localname.'.info', 'r'); - $filetype = fgets ($fileinfo, 8192); - fclose ($fileinfo); - $filetype = trim ($filetype); - if ($filetype=='') + foreach ($attachments as $info) + { + $filetype = $info['type']; + if ($filetype == '') $filetype = 'application/octet-stream'; $header = '--'.mimeBoundary()."\r\n"; - $header .= "Content-Type: $filetype;name=\"$remotename\"\r\n"; - $header .= "Content-Disposition: attachment; filename=\"$remotename\"\r\n"; + $header .= "Content-Type: $filetype; name=\"" . + $info['remotefilename'] . "\"\r\n"; + $header .= "Content-Disposition: attachment; filename=\"" . + $info['remotefilename'] . "\"\r\n"; $header .= "Content-Transfer-Encoding: base64\r\n\r\n"; fputs ($fp, $header); $length += strlen($header); - $file = fopen ($attachment_dir.$localname, 'r'); + $file = fopen ($attachment_dir . $info['localfilename'], 'r'); while ($tmp = fread($file, 570)) { $encoded = chunk_split(base64_encode($tmp)); $length += strlen($encoded); @@ -556,7 +551,7 @@ } sqimap_logout($imap_stream); // Delete the files uploaded for attaching (if any). - deleteAttachments(); + ClearAttachments(); } ?>