Commit: 9a053e3caa3633f448f5a5d7ea456efb1cdb2d10 Author: Anatol Belski <[email protected]> Sat, 14 Sep 2013 21:21:30 +0200 Parents: 52159957a15707492130d4397a8e79b2093d535d Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=9a053e3caa3633f448f5a5d7ea456efb1cdb2d10 Log: fixed the xmail function Changed paths: M client/include/Tools.php Diff: diff --git a/client/include/Tools.php b/client/include/Tools.php index ec3a5f1..77d02e4 100644 --- a/client/include/Tools.php +++ b/client/include/Tools.php @@ -334,20 +334,19 @@ function copy_r($from, $to) function xmail($from, $to, $subject, $text, array $attachment = array()) { $header = $mail = array(); - $boundary = '--' . md5(uniqid(mt_rand(), 1)); + $boundary = md5(uniqid(mt_rand(), 1)); $header[] = "MIME-Version: 1.0"; $header[] = "From: $from"; + $header[] = "Content-Type: multipart/mixed;\r\n boundary=\"$boundary\""; - $mail[] = "Content-Type: multipart/mixed; boundary=\"$boundary\""; - $mail[] = $boundary; + $mail[] = '--' . $boundary; $mail[] = "Content-Type: text/plain; charset=latin1"; $mail[] = "Content-Transfer-Encoding: 7bit\r\n"; $mail[] = "$text\r\n"; - $mail[] = $boundary; foreach($attachment as $att) { - if (!$att || !file_exists(!$att) || !is_file($att) || !is_readable($att)) { + if (!$att || !file_exists($att) || !is_file($att) || !is_readable($att)) { continue; } @@ -360,13 +359,15 @@ function xmail($from, $to, $subject, $text, array $attachment = array()) } $raw = file_get_contents($att); + $mail[] = '--' . $boundary; $mail[] = "Content-Type: $mime_type; name=\"$fname\""; $mail[] = "Content-Transfer-Encoding: base64"; $mail[] = "Content-Disposition: attachment; filename=\"$fname\"; size=\"$fsize\"\r\n"; $mail[] = chunk_split(base64_encode($raw)) . "\r\n"; - $mail[] = $boundary; } + $mail[] = '--' . $boundary . '--'; + return mail($to, $subject, implode("\r\n", $mail), implode("\r\n", $header)); } -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
