X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fsmtp.php;h=d10f6854a45a541b0b6d7b49a86bbe59c395be85;hp=903ec0157e7bcfc349bbdcb771382b2245e66920;hb=21f3c131eb4c0c70d76ceb3f52dd74f89fcf32e5;hpb=a7b90f05ac8a08954d355b96ab133ddaa2690221 diff --git a/functions/smtp.php b/functions/smtp.php index 903ec015..d10f6854 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -147,8 +147,10 @@ function attachFiles ($fp, $session, $rn="\r\n") { $file = fopen ($filename, 'rb'); if (substr($filetype, 0, 5) == 'text/' || substr($filetype, 0, 8) == 'message/' ) { - $header .= "$rn"; - if ($fp) fputs ($fp, $header); + $header .= $rn; + if ($fp) { + fputs ($fp, $header); + } $length += strlen($header); while ($tmp = fgets($file, 4096)) { $tmp = str_replace("\r\n", "\n", $tmp); @@ -160,10 +162,12 @@ function attachFiles ($fp, $session, $rn="\r\n") { * Check if the last line has newline ($rn) in it * and append if it doesn't. */ - if (feof($fp) && !strstr($tmp, "$rn")){ - $tmp .= "$rn"; + if ($fp && feof($fp) && !strstr($tmp, "$rn")){ + $tmp .= $rn; + } + if ($fp) { + fputs($fp, $tmp); } - if ($fp) fputs($fp, $tmp); $length += strlen($tmp); } } else {