fix for bug #585836
authorjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Jul 2002 05:16:53 +0000 (05:16 +0000)
committerjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Jul 2002 05:16:53 +0000 (05:16 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3151 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/smtp.php

index 1ae2cbfad26423269c3bcfc331743dd8e51b8bc2..f04200a874d9a27534a35b3c97e289e44b3e5015 100644 (file)
@@ -158,18 +158,16 @@ function attachFiles ($fp, $session, $rn="\r\n") {
                         if ($rn == "\r\n"){
                             $tmp = str_replace("\n", "\r\n", $tmp);
                         }
-                        /**
-                         * Check if the last line has newline ($rn) in it
-                         * and append if it doesn't.
-                         */
-                        if ($file && feof($file) && !strstr($tmp, "$rn")){
-                            $tmp .= $rn;
-                        }
                         if ($fp) {
                             fputs($fp, $tmp);
                         }
                         $length += strlen($tmp);
                     }
+                    if (substr($tmp, strlen($tmp) - strlen($rn), strlen($rn)) != $rn) {
+                        if ($fp) {
+                            fputs($fp, $rn);
+                        }
+                    }
                 } else {
                     $header .= "Content-Transfer-Encoding: base64" 
                         . "$rn" . "$rn";