Skip to content

Commit

Permalink
Version 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
psthmn committed Aug 17, 2015
2 parents cf59191 + 6144906 commit fac252d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions assets/snippets/ddTools/modx.ddtools.class.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* modx ddTools class
* @version 0.13 (2014-07-13)
* @version 0.13.1 (2015-08-17)
*
* @uses modx 1.0.10 (Evo)
*
* @link http://code.divandesign.biz/modx/ddtools/0.13
*
* @copyright 2014, DivanDesign
* @copyright 2015, DivanDesign
* http://www.DivanDesign.biz
*/

Expand Down Expand Up @@ -1047,14 +1047,14 @@ public static function sendMail($to, $text, $from = '[email protected]', $sub
//Конвертируем тему в base64
$subject = "=?UTF-8?B?".base64_encode($subject)."?=";
//Заголовки сообщения
$headers = "From: $from\r\nMIME-Version: 1.0\r\n";
$headers = "From: ".$from.PHP_EOL."MIME-Version: 1.0".PHP_EOL;

//Разделитель блоков в сообщении
$bound = 'bound'.md5(time());
$multipart = "Content-Type: multipart/mixed; boundary = \"".$bound."\"\r\n\r\n--".$bound;
$multipart = "Content-Type: multipart/mixed; boundary = \"".$bound."\"".PHP_EOL."--".$bound.PHP_EOL;

//Добавлеям текст в сообщения
$multipart .= "\r\nContent-Type: text/html; charset=UTF-8 \r\n\r\n".$text."\r\n\r\n--".$bound;
$multipart .= "Content-Type: text/html; charset=UTF-8 ".PHP_EOL.trim($text, PHP_EOL).PHP_EOL."--".$bound;

if(!empty($fileInputName)){
$attachFiles = array();
Expand Down Expand Up @@ -1088,16 +1088,16 @@ public static function sendMail($to, $text, $from = '[email protected]', $sub
//Перебираем присоединяемые файлы
if(!empty($attachFiles)){
foreach($attachFiles as $name => $value){
$multipart .= "\r\n".
'Content-Type: application/octet-stream; name = "=?UTF-8?B?'.base64_encode($name)."?=\"\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n".
base64_encode($value)."\r\n\r\n--".$bound;
$multipart .= PHP_EOL.
'Content-Type: application/octet-stream; name = "=?UTF-8?B?'.base64_encode($name)."?=\"".PHP_EOL.
"Content-Transfer-Encoding: base64".PHP_EOL.
base64_encode($value).PHP_EOL."--".$bound;
}
}
}

//Добавляем разделитель окончания сообщения
$headers .= $multipart."--\r\n";
$headers .= $multipart."--".PHP_EOL;

$result = array();

Expand Down

0 comments on commit fac252d

Please sign in to comment.