|
@ -1,12 +1,12 @@ |
|
|
<?php |
|
|
<?php |
|
|
/** |
|
|
/** |
|
|
* Класс для отправки почты |
|
|
* Класс для отправки почты |
|
|
* |
|
|
|
|
|
* @copyright NetMonsters <team@netmonsters.ru> |
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
* @copyright NetMonsters <team@netmonsters.ru> |
|
|
* @link http://netmonsters.ru |
|
|
* @link http://netmonsters.ru |
|
|
* @package Core |
|
|
* @package Core |
|
|
* @subpackage mail |
|
|
* @subpackage mail |
|
|
* @since |
|
|
|
|
|
|
|
|
* @since |
|
|
* @version SVN: $Id$ |
|
|
* @version SVN: $Id$ |
|
|
* @filesource $URL$ |
|
|
* @filesource $URL$ |
|
|
*/ |
|
|
*/ |
|
@ -18,16 +18,16 @@ class Mailer |
|
|
public $templater; |
|
|
public $templater; |
|
|
public $headers; |
|
|
public $headers; |
|
|
protected $host; |
|
|
protected $host; |
|
|
|
|
|
|
|
|
function __construct($host, $template = null) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function __construct($host, $template = null) |
|
|
{ |
|
|
{ |
|
|
if ($template !== null) { |
|
|
if ($template !== null) { |
|
|
$this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir); |
|
|
$this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir); |
|
|
$this->template = $template; |
|
|
$this->template = $template; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->host = $host; |
|
|
$this->host = $host; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->headers .= 'From: robot@' . $this->host . "\r\n"; |
|
|
$this->headers .= 'From: robot@' . $this->host . "\r\n"; |
|
|
$this->headers .= 'Date: '. date('r') ."\r\n"; |
|
|
$this->headers .= 'Date: '. date('r') ."\r\n"; |
|
|
$this->headers .= "Return-Path: robot@". $this->host ."\r\n"; |
|
|
$this->headers .= "Return-Path: robot@". $this->host ."\r\n"; |
|
@ -43,7 +43,7 @@ class Mailer |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Отправляет письма |
|
|
* Отправляет письма |
|
|
* |
|
|
|
|
|
|
|
|
* |
|
|
* @param mixed $mail |
|
|
* @param mixed $mail |
|
|
* @param mixed $subject |
|
|
* @param mixed $subject |
|
|
* @param mixed $data |
|
|
* @param mixed $data |
|
@ -51,19 +51,19 @@ class Mailer |
|
|
function send ($mail, $subject, $data) |
|
|
function send ($mail, $subject, $data) |
|
|
{ |
|
|
{ |
|
|
$this->headers .= "To: ".$mail."\r\n"; |
|
|
$this->headers .= "To: ".$mail."\r\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($data as $key => $val) { |
|
|
foreach ($data as $key => $val) { |
|
|
$this->templater->assign($key, $val); |
|
|
$this->templater->assign($key, $val); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$message = $this->templater->fetch($this->template.'.tpl'); |
|
|
$message = $this->templater->fetch($this->template.'.tpl'); |
|
|
$encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n"; |
|
|
$encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n"; |
|
|
return mail($mail, $subject, $message, $this->headers); |
|
|
return mail($mail, $subject, $message, $this->headers); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Отправка письма с непосредственным указанием контента |
|
|
* Отправка письма с непосредственным указанием контента |
|
|
* |
|
|
|
|
|
|
|
|
* |
|
|
* @param string $email |
|
|
* @param string $email |
|
|
* @param string $subject |
|
|
* @param string $subject |
|
|
* @param string $content |
|
|
* @param string $content |
|
@ -75,4 +75,4 @@ class Mailer |
|
|
return mail($email, $encoded_subject, $content, $this->headers); |
|
|
return mail($email, $encoded_subject, $content, $this->headers); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
?>
|
|
|
|
|
|
|
|
|
?>
|